Re: text vs varchar(n)

Поиск
Список
Период
Сортировка
От Robert Treat
Тема Re: text vs varchar(n)
Дата
Msg-id AMENJOLMNKAEOIGHHILBKEKFCHAA.robertt@auctionsolutions.com
обсуждение исходный текст
Ответ на Re: text vs varchar(n)  (Einar Karttunen <ekarttun@cs.helsinki.fi>)
Ответы Re: text vs varchar(n)
Re: text vs varchar(n)
Список 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 по дате отправления:

Предыдущее
От: Roy Cabaniss
Дата:
Сообщение: Av "OID" ing working
Следующее
От: Tom Lane
Дата:
Сообщение: Re: OID and 7.2 release