Re: Physical column size

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Physical column size
Дата
Msg-id 200603031123.22453.peter_e@gmx.net
обсуждение исходный текст
Ответ на Physical column size  ("Paul Mackay" <mackaypaul@gmail.com>)
Ответы Re: Physical column size
Список pgsql-general
Am Freitag, 3. März 2006 11:03 schrieb Paul Mackay:
> I've created a table like this :
> CREATE TABLE tmp_A (
> c "char",
> i int4
> );
>
> And another one
> CREATE TABLE tmp_B (
> i int4,
> ii int4
> );

> The end result is that the physical size on disk used by table tmp_A is
> exactly the same as table tmp_B (as revealed by the pg_relation_size
> function) !

An int4 field is required to be aligned at a 4-byte boundary internally, so
there are 3 bytes wasted between tmp_A.c and tmp_A.i.  If you switch the
order of the fields you should see space savings.  (Note, however, that the
per-row overhead is about 32 bytes, so you'll probably only save about 10%
overall, rather than the 37.5% that one might expect.)

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

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

Предыдущее
От: Csaba Nagy
Дата:
Сообщение: Re: query timeout
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Physical column size