From: Stephen Robert Norris <srn@commsecure.com.au>
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: Thu, 18 Mar 2004 11:07:35 +1100
Message-ID: <1079568455.12785.3.camel@ws12.commsecure.com.au> (raw)
In-Reply-To: <p0510034bbc7e94bbd838@[135.185.171.143]>
References: <p0510034bbc7e94bbd838@[135.185.171.143]>
On Thu, 2004-03-18 at 10:52, Seum-Lim Gan wrote:
> Hi all,
>
> 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.
>
> Any clues if there's any parameter or bug causing that?
>
> Gan (for Amgad)
Well, you're size counts are completely wrong, for starters.
Each varchar uses 4 bytes + length of the string, so that's 8 more bytes
per row. Then you may have an OID as well for another 4 bytes. I'd also
not be surprised if the length of the string is rounded up to the
nearest word (although I don't know if it is), and I'd be amazed if the
length of the record isn't rounded to some boundary too.
There's a handy page in the documentation that talks about how to know
how big rows are, I suggest you start there...
Stephen
Attachments:
signature.asc (application/pgp-signature, 188B) download
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: srn@commsecure.com.au, slgan@lucent.com, ahsaleh@lucent.com
Subject: Re: PostgreSQL Disk Usage and Page Size
In-Reply-To: <1079568455.12785.3.camel@ws12.commsecure.com.au>
* 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