Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Sun, 25 Mar 2001 16:14:51 -0500
  • Message-id: <19429.985554891@sss.pgh.pa.us> <text/plain>

"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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group