pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: jack <datactrl@tpg.com.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: please advise on column data type
Date: Tue, 16 Apr 2002 00:47:12 -0400
Message-ID: <9330.1018932432@sss.pgh.pa.us> (raw)
In-Reply-To: <web-1371907@davinci.ethosmedia.com>
References: <web-1371907@davinci.ethosmedia.com>

"Josh Berkus" <josh@agliodbs.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



view thread (3+ messages)

Message-ID: <9330.1018932432@sss.pgh.pa.us>
Permalink:  ../9330.1018932432@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9330.1018932432@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, datactrl@tpg.com.au
  Subject: Re: please advise on column data type
  In-Reply-To: <9330.1018932432@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox