Re: byte-size of column values

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: byte-size of column values
Дата
Msg-id 2840902.1666186460@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: byte-size of column values  (Dominique Devienne <ddevienne@gmail.com>)
Список pgsql-general
Dominique Devienne <ddevienne@gmail.com> writes:
> On Tue, Oct 18, 2022 at 6:04 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Thus, there's always a header to store the actual length.  That can
>> be either 1 or 4 bytes (I think the doc you are looking at might be
>> a little out of date on that point).

> Even the doc on v15 (or devel) still says 5-to-8.
> https://www.postgresql.org/docs/15/datatype-bit.html

Oh, if you're thinking about bit rather than string types,
that's correct: in addition to the overall-field-width
header (1 or 4 bytes) there's a length-in-bits field
(always 4 bytes), then the bits themselves.  The overall
width is clearly insufficient to know how many bits are
valid in the last byte, so some additional storage is
necessary.  This could have been done in a more compact
way no doubt, but we aren't likely to change it now.

            regards, tom lane



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

Предыдущее
От: Dominique Devienne
Дата:
Сообщение: Re: How to store "blobs" efficiently for small and large sizes, with random access
Следующее
От: Ron
Дата:
Сообщение: Re: Is this error expected ?