From: Tom Lane <tgl@sss.pgh.pa.us>
To: Scott Marlowe <smarlowe@g2switchworks.com>
Cc: Joe Bloggs <polonium210@googlemail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Disk space usage
Date: Wed, 29 Nov 2006 16:25:45 -0500
Message-ID: <4664.1164835545@sss.pgh.pa.us> (raw)
In-Reply-To: <1164833192.14565.221.camel@state.g2switchworks.com>
References: <b07e99670611291157y3f65598akc27c88949a13e2e2@mail.gmail.com>
<1164833192.14565.221.camel@state.g2switchworks.com>
Scott Marlowe <smarlowe@g2switchworks.com> writes:
> On Wed, 2006-11-29 at 13:57, Joe Bloggs wrote:
>> I created a table in 8.1.5 on Linux with three columns;
>> date, bigint and integer.
>>
>> I looked at the size of the file that contained the table and divided
>> this by the number of rows which gave an average of just over 60 bytes
>> per row.
>>
>> This seems to be quite a large overhead as I would guess that the date
>> field takes around 4 bytes, the bigint 8 bytes and the integer 4
>> bytes. I would have hoped to have had an average size of between 20
>> and 30 bytes per row.
> Had you done any updates to the tables?
I think it's about dead on, if he's using a machine with MAXALIGN 8:
Row's item pointer 4 bytes
Row header 32 bytes (including alignment padding)
date column 4 bytes
alignment padding 4 bytes
bigint column 8 bytes
integer column 4 bytes
alignment padding 4 bytes
--------
60 bytes
The choice of column order is unfortunate --- if he'd put the bigint
column either first or last, there wouldn't be the alignment penalties.
Hopefully we'll be able to get the row header back down to 24 bytes in
8.3, but it's never going to be the 4-or-so-bytes that the OP is
imagining.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, smarlowe@g2switchworks.com, polonium210@googlemail.com
Subject: Re: Disk space usage
In-Reply-To: <4664.1164835545@sss.pgh.pa.us>
References: <b07e99670611291157y3f65598akc27c88949a13e2e2@mail.gmail.com> <1164833192.14565.221.camel@state.g2switchworks.com> <4664.1164835545@sss.pgh.pa.us>
* 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