Re: difference b/w text and varchar datatypes

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Harpreet Dhaliwal <harpreet(dot)dhaliwal01(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: difference b/w text and varchar datatypes
Date: 2006-10-16 18:58:08
Message-ID: 20061016185808.96652.qmail@web31803.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Just wanted to know how would it make a difference if i use text datatype
> instead of varchar.

Taken from: http://www.postgresql.org/docs/8.1/interactive/datatype-character.html
"
If character varying is used without length specifier, the type accepts strings of any size. The
latter is a PostgreSQL extension.

In addition, PostgreSQL provides the text type, which stores strings of any length. Although the
type text is not in the SQL standard, several other SQL database management systems have it as
well.

...

Tip: There are no performance differences between these three types, apart from the increased
storage size when using the blank-padded type. While character(n) has performance advantages in
some other database systems, it has no such advantages in PostgreSQL. In most situations text or
character varying should be used instead.
"

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bricklen Anderson 2006-10-16 19:02:34 Re: function for current date-time
Previous Message Harpreet Dhaliwal 2006-10-16 18:56:27 function for current date-time