Re: [NOVICE] varchar vs varchar(n)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [NOVICE] varchar vs varchar(n)
Дата
Msg-id 30799.1510587592@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [NOVICE] varchar vs varchar(n)  (Ken Benson <Ken@infowerks.com>)
Список pgsql-novice
Ken Benson <Ken@infowerks.com> writes:
> On Sun, Nov 12, 2017 at 2:34 PM, Tom Lane <tgl@sss.pgh.pa.us<mailto:tgl@sss.pgh.pa.us>> wrote:
> Generally speaking, I would only use varchar(n) when there is a clear
> reason traceable to application requirements why there has to be a
> limit, and why the limit should be n and not some other number.

> Is this true – even if the column in question will be used in (or as part of) an INDEX.
> It seems to be the index would work best if the length of the columns involved is a known value.

varchar(n) doesn't have a known length.  Even char(n) doesn't have a known
length in the presence of variable-width text encodings.  So there are no
optimizations of the sort you're imagining in Postgres.
        regards, tom lane


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [NOVICE] array_agg cast issue
Следующее
От: pinker
Дата:
Сообщение: Re: [NOVICE] array_agg cast issue