Re: Re: underlying structure: varchar vs. text

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: underlying structure: varchar vs. text
Дата
Msg-id 2728.989018937@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: underlying structure: varchar vs. text  ("Mitch Vincent" <mitch@venux.net>)
Список pgsql-general
"Mitch Vincent" <mitch@venux.net> writes:
>> I'm not sure if that is actually more efficient, nor do I know the limit
>> of how big you can make a varchar.

> I think I remember Tom saying it was around 2100 bytes. I could be pretty
> far off on that though.

In 7.1 there's no real limit.  (I think the parser arbitrarily insists
that the N in varchar(N) be no more than 10 million, just on the theory
that it's probably a typo if you wrote more.  That's easily changed if
you really have a use for "varchar(100000000)" as opposed to just plain
"text" ... but offhand I can't see what it would be.  Text is the
appropriate type to use if you don't have a specific width limit in
mind.)

As far as efficiency goes, the only difference between text and
varchar() is the extra function call involved in applying varchar's
length limit check just before inserting or updating a row.  Physical
storage is the same.

The 2100 number refers to the maximum length of text that can be
indexed.  That hasn't moved much in 7.1, but I can't really see the
value of a direct index on megabyte-sized text values anyway...

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Martín Marqués
Дата:
Сообщение: how to see rules
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Daylight savings