Re: CHAR or VARCHAR - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: CHAR or VARCHAR
Date
Msg-id Pine.BSF.4.21.0103211715080.37589-100000@megazone23.bigpanda.com
Whole thread Raw
In response to CHAR or VARCHAR  ("Martin A. Marques" <martin@math.unl.edu.ar>)
Responses Re: CHAR or VARCHAR
List pgsql-sql
On Wed, 21 Mar 2001, Martin A. Marques wrote:

> two questions.
> When should I use one, and when the other?

Almost always varchar() unless you know that your
input is of constant size.

> Which is the limit on CHAR(n) and VARCHAR(n)?

In 7.0.x and earlier, there's an row limit
for all values in a row which defaulted to 8k (just
below technically i believe) but could be raised 
at compile time to 32k.
All fields in the row had to fit in that 8-32k.
So you'd have to figure the limit out based on the
other fields.

In 7.1(currently in beta), long values can be stored
outside that so you have more of a number of columns
limit rather than a per value limit.  Technically,
it's probably still not a great idea to be sticking
megs in there for performance reasons.

[I seem to remember at least on older versions there 
was a further limit on things that were indexed, but 
I don't remember the issues with that.]




pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: CHAR or VARCHAR
Next
From: Hiroshi Inoue
Date:
Subject: Re: Error when selecting rows from a temporary table in ODBC