Re: database size estimates

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: "Francois Deliege" <fdeliege(at)cs(dot)aau(dot)dk>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: database size estimates
Date: 2007-04-25 23:11:49
Message-ID: 87mz0w9hhm.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:

> Francois Deliege wrote:
>> Hi,
>>
>> I am trying to estimate the size of a table composed of 51754000 rows.
>> Each row has 31 attributes: 16 x bit(24) and 15 x bit(8)
>>
>> So, the payload should be:
>> 51754000 x ( 16 x 24 + 15 x 24 ) bits = 3115 MB
>
> What data types are those exactly? If those 24-bit fields are in fact text,
> varchar, char(x) or other data types that are stored as variable length fields,

And sadly that includes bit() if you're being literal.

As of Postgres 8.1 you can see how much space a column is taking up using the
pg_column_size() function. This won't include alignment padding but will
include the length header for that column.

You can see how much a given row is taking up by passing the entire row to
og_column_size with something like pg_column_size(tab.*)

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2007-04-25 23:20:19 Re: Fragmentation project
Previous Message Reece Hart 2007-04-25 23:00:59 Re: Schema as versioning strategy