From: | "Robert Treat" <robertt(at)auctionsolutions(dot)com> |
---|---|
To: | "Einar Karttunen" <ekarttun(at)cs(dot)helsinki(dot)fi> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: text vs varchar(n) |
Date: | 2002-02-19 15:30:45 |
Message-ID: | AMENJOLMNKAEOIGHHILBKEKFCHAA.robertt@auctionsolutions.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Einar Karttunen
> Sent: Monday, February 18, 2002 12:55 AM
> To: Richard Emberson
> Cc: pgsql-general(at)postgresql(dot)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(at)postgresql(dot)org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-02-19 15:40:08 | Re: OID and 7.2 release |
Previous Message | Roy Cabaniss | 2002-02-19 15:29:47 | Av "OID" ing working |