Re: CHAR(N) storage requirement

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: CHAR(N) storage requirement
Дата
Msg-id 200401111702.00538.peter_e@gmx.net
обсуждение исходный текст
Ответ на CHAR(N) storage requirement  (David Garamond <lists@zara.6.isreserved.com>)
Ответы Re: CHAR(N) storage requirement  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: CHAR(N) storage requirement  (David Garamond <lists@zara.6.isreserved.com>)
Список pgsql-general
David Garamond wrote:
> Is it the 4+N (aka. same as VARCHAR(n)) or is it N? Sorry, it was
> 100% not clear for me after reading the docs, though the docs imply
> the first: "The storage requirement for data of these types is 4
> bytes plus the actual string, and in case of character plus the
> padding."

Storing varchar(n) takes 4 bytes plus as many bytes as are required to
store the actual string.  This may be more or less then "n".

Storing char(n) takes 4 bytes plus as many bytes are are required to
store the actual string, plus n - length(value) bytes for padding
spaces.  This is at least "n" bytes.


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

Предыдущее
От: David Garamond
Дата:
Сообщение: Drawbacks of using BYTEA for PK?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: CHAR(N) storage requirement