From: Martin A. Marques <martin@math.unl.edu.ar>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: CHAR or VARCHAR
Date: Thu, 22 Mar 2001 08:05:19 -0300
Message-ID: <01032208051900.07158@math.unl.edu.ar> (raw)
In-Reply-To: <Pine.BSF.4.21.0103211715080.37589-100000@megazone23.bigpanda.com>
References: <Pine.BSF.4.21.0103211715080.37589-100000@megazone23.bigpanda.com>
El Mié 21 Mar 2001 22:21, Stephan Szabo escribió:
> 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.
How does performace look when doing lots of searches on a VARCHAR column with
respect of a CHAR column? That is my main concern.
I mean, what if I have to do lots of queries with LIKEs on that column?
> > 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 can't believe that there is no limit. You mean that I put this:
VARCHAR(1000000000000000000000000000000000)
?
Saludos... :-)
--
System Administration: It's a dirty job,
but someone told me I had to do it.
-----------------------------------------------------------------
Martín Marqués email: martin@math.unl.edu.ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: martin@math.unl.edu.ar, sszabo@megazone23.bigpanda.com
Subject: Re: CHAR or VARCHAR
In-Reply-To: <01032208051900.07158@math.unl.edu.ar>
References: <Pine.BSF.4.21.0103211715080.37589-100000@megazone23.bigpanda.com> <01032208051900.07158@math.unl.edu.ar>
* 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