Re: CHAR or VARCHAR

From: "Peter J(dot) Schoenster" <borg(at)errorcode(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: CHAR or VARCHAR
Date: 2001-03-22 01:10:31
Message-ID: 3AB8EE97.16683.AF4807A@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 21 Mar 2001, at 18:58, Martin A. Marques wrote:

> two questions.
> When should I use one, and when the other?
> Which is the limit on CHAR(n) and VARCHAR(n)?

Okay, here is my more "let's get this thing working" as opposed to
"after dedicated study of the matter" opinion (which I hope some
dedicated studier might correct or confirm or extend) (and, ps, I do
99% of dev on mysql):

I live under the assumption that indexes on CHAR will be "faster"
but that CHAR may vary well consume more disk space as I
believe it pads data to fit the size you created for it.

This page does not help much:

http://www.postgresql.org/docs/user/datatype1066.htm

This page is interesting:

http://www.postgresql.org/docs/user/sql-createindex.htm

> Tip: Indexes are primarily used to enhance database performance. But
> inappropriate use will result in slower performance.

I rarely index a table if there are many inserts/updates.

So char vs. varchar ....

Peter

---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
-- Philip K. Dick

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2001-03-22 01:21:25 Re: CHAR or VARCHAR
Previous Message Josh Berkus 2001-03-22 00:27:48 Re: CHAR or VARCHAR