Re: CHAR or VARCHAR

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: peter(at)schoenster(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: CHAR or VARCHAR
Date: 2001-03-25 21:14:51
Message-ID: 19429.985554891@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Peter J. Schoenster" <peter(at)schoenster(dot)com> writes:
> On 22 Mar 2001, at 10:05, Tom Lane wrote:
>> There is *no* performance advantage of CHAR(n) over VARCHAR(n).

> I wonder if this question of char/varchar is postgresql specific or
> rdbms in general.

It's definitely RDBMS-specific. My comment applied to Postgres, which
stores CHAR(n) and VARCHAR(n) in essentially the same fashion --- it
doesn't really exploit the fact that CHAR(n) is fixed-size. (Mainly
because it's *not* fixed size in PG, what with TOAST, multibyte, etc.)

On other DBMSes there could be a difference, especially if the DBMS has
performance problems with variable-length fields.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Grant 2001-03-25 23:58:57 Re: Serials.
Previous Message Richard Huxton 2001-03-25 20:23:22 Re: Help