pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Seum-Lim Gan <slgan@lucent.com>
Cc: pgsql-performance@postgresql.org
Cc: ahsaleh@lucent.com
Subject: Re: PostgreSQL Disk Usage and Page Size
Date: Wed, 17 Mar 2004 16:18:02 -0800 (PST)
Message-ID: <20040317160012.G32224@megazone.bigpanda.com> (raw)
In-Reply-To: <p0510034bbc7e94bbd838@[135.185.171.143]>
References: <p0510034bbc7e94bbd838@[135.185.171.143]>

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.



view thread (5+ messages)  latest in thread

Message-ID: <20040317160012.G32224@megazone.bigpanda.com>
Permalink:  ../20040317160012.G32224@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040317160012.G32224@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, slgan@lucent.com, ahsaleh@lucent.com
  Subject: Re: PostgreSQL Disk Usage and Page Size
  In-Reply-To: <20040317160012.G32224@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox