Re: Postgres table size

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: SHARMILA JOTHIRAJAH <sharmi_jo(at)yahoo(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Erik Jones <erik(at)myemma(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres table size
Date: 2007-11-22 12:48:37
Message-ID: 20071122124837.GA6113@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 21, 2007 at 09:51:22AM -0800, SHARMILA JOTHIRAJAH wrote:
> Thanks for the detailed explanation Tom. You are rigt...The number of pages for this tables as per pg_class is 189.
>
> I have a few questions
> 1. How do you find the MAXALIGN of the machine? And what is that used for?

MAXALIGN is the preferred alignment for structure objects, iirc. It's
generally less efficient to access unaligned objects than aligned ones,
though this is architechure specific. You should be able to find it in
your pg_config.h under MAXIMUM_ALIGNOF,.

> 2. How does null columns account for this space. For example, if I
> have the same table (10 cols --5 varchars and 5 numerics) in which 8
> cols are null and 2 cols(1 varchar and 1 num) are not null, how is
> the storage space affected for this case?

The cost is typically one bit per column in the table, unless there are
no NULLs in which case it costs nothing. 10 cols = 2 bytes, which may
or may not be swallowed by alignment.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message luca.ciciriello 2007-11-22 13:10:49 BEGIN strange behaviour
Previous Message Oleg Bartunov 2007-11-22 10:57:34 Re: EAV or not to EAV?