Re: please advise on column data type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: "jack" <datactrl(at)tpg(dot)com(dot)au>, pgsql-sql(at)postgresql(dot)org
Subject: Re: please advise on column data type
Date: 2002-04-16 04:47:12
Message-ID: 9330.1018932432@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)com> writes:
> In some databases, yes. However, in PostgreSQL, there is no
> performance difference between CHAR, VARCHAR, and TEXT. So use what's
> appropriate for the data being stored.

In fact, char() is probably *worse* than the other alternatives, at
least for data that doesn't have a clearly defined length, because
it forces blank-padding on you.

I'd use char(N) for US postal abbreviations (state = char(2), etc)
and not a lot else. If you have an *error checking* reason to use
char(N), then use it. If you think you are getting a performance
improvement, then you are far out in left field.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John Proctor 2002-04-16 04:49:21 Re: [SQL] 16 parameter limit
Previous Message Peter Eisentraut 2002-04-16 04:36:11 Re: [PATCHES] [SQL] 16 parameter limit