Re: text vs varchar(n) - Mailing list pgsql-general

From Robert Treat
Subject Re: text vs varchar(n)
Date
Msg-id AMENJOLMNKAEOIGHHILBKEKFCHAA.robertt@auctionsolutions.com
Whole thread Raw
In response to Re: text vs varchar(n)  (Einar Karttunen <ekarttun@cs.helsinki.fi>)
Responses Re: text vs varchar(n)
Re: text vs varchar(n)
List pgsql-general
I had always thought that the db would get *some* performance increase
simply by knowing that x column in a table would never be longer than n
characters, meaning it could allocate space ahead of time for those columns
as needed. Is this correct or is there really no benefit to using
varchar(n)?

I want to clarify because one of my coworkers is considering switching a
table he has that is all text fields to all varchar(255) and if there really
is no benefit I'll tell him to save his time. Furthermore I'd actually start
recomending to people to use text fields rather than varchar(n) if this is
true.

Robert

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Einar Karttunen
> Sent: Monday, February 18, 2002 12:55 AM
> To: Richard Emberson
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] text vs varchar(n)
>
>
> On 17.02.02 21:52 -0800(+0000), Richard Emberson wrote:
> > Which is faster read and write, a table with text or varchar types:
> >
> > ...
> >
> > Why would one every use varchar(n) instead of text (aside from non-sql
> > standard)?
> >
>
> Varchar(n) and text have the same performance. The difference is that
> varchars are silently cut if they are longer than the limit specified.
> In most cases you want to stick with text.
>
> - Einar Karttunen
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


pgsql-general by date:

Previous
From: Roy Cabaniss
Date:
Subject: Av "OID" ing working
Next
From: Tom Lane
Date:
Subject: Re: OID and 7.2 release