Re: Postgres table size - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Postgres table size
Date
Msg-id 20071122124837.GA6113@svana.org
Whole thread Raw
In response to Re: Postgres table size  (SHARMILA JOTHIRAJAH <sharmi_jo@yahoo.com>)
List 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@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: EAV or not to EAV?
Next
From: luca.ciciriello@email.it
Date:
Subject: BEGIN strange behaviour