Re: varchar vs. text

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: varchar vs. text
Date: 2003-09-18 10:25:17
Message-ID: 1063880717.11739.1590.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2003-09-17 at 22:59, Michael Garriss wrote:
> I curious about the benefits of a varchar over text. Is it speed,
> size? If so, how much speed, size? Is a varchar(64) and a text with 64
> chars the same size? I'm inclined to make all my varchars into text so
> I don't have to worry about inserting something to big.

An analyst would say that "correctness" is a reason for specifying
a max length. For example, in t_names, I could stick "War and Peace"
into first_name, but, obviously, that's not "correct".

CREATE TABLE t_names (
first_name TEXT,
last_name TEXT );

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron(dot)l(dot)johnson(at)cox(dot)net
Jefferson, LA USA

"(Women are) like compilers. They take simple statements and
make them into big productions."
Pitr Dubovitch

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2003-09-18 12:08:28 Re: Why does adding SUM and GROUP BY destroy performance?
Previous Message Ron Johnson 2003-09-18 10:09:14 Re: Why does adding SUM and GROUP BY destroy performance?