Re: PostgreSQL Disk Usage and Page Size

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: PostgreSQL Disk Usage and Page Size
Дата
Msg-id 20040317160012.G32224@megazone.bigpanda.com
обсуждение исходный текст
Ответ на PostgreSQL Disk Usage and Page Size  (Seum-Lim Gan <slgan@lucent.com>)
Список pgsql-performance
On Wed, 17 Mar 2004, Seum-Lim Gan wrote:

> we have a question about the pagesize in PostgreSQL:
>
> Using different pagesizes: 4K, 8K, 16K, 32K, when we store different
> record sizes
> such as in the following example:
>
> CREATE TABLE TEST_1 (
> F1 VARCHAR(10),
> F2 VARCHAR(5) );
>
> CREATE TABLE TEST_2 (
> F1 VARCHAR(10),
> F2 VARCHAR(10) );
>
> we're consistently having the following storage behavior:
>
> 60 records / 4k_page
> 120 records / 8k_page
> 240 records / 16k_page
> 480 records / 32k_page.
>
> So it seems that it doesn't matter whether the record size is
> 15 bytes or 20 bytes, there's maximum number of records per page
> as shown above.

The rows aren't 15 or 20 bytes, they're something closer to:

row header (24 bytes?) + f1 length (4 bytes) + actual bytes for f1 +
f2 length (4 bytes) + actual bytes for f2
(I'm not sure about additional padding, but there's probably some to word
boundaries)

And since you're using varchar, you won't see an actual row size
difference unless you're using different data between the two tables.

If you're in a one byte encoding and putting in maximum length strings,
I'd expect something like 52 and 56 bytes for the above two tables.

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

Предыдущее
От: Stephen Robert Norris
Дата:
Сообщение: Re: PostgreSQL Disk Usage and Page Size
Следующее
От: Tom Lane
Дата:
Сообщение: Re: severe performance issue with planner (fwd)