Question on Byte Sizes

From: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
To: performance(at)postgresql(dot)org
Subject: Question on Byte Sizes
Date: 2004-09-10 06:36:16
Message-ID: opsd3lyqygcq72hf@musicbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

* I need information on the size of pg ARRAY[]'s :

I did not find any info in the Docs on this.
How many bytes does an array take on disk ?

Is there a difference between an array of fixed size elements like
integers, and an array of variable length elements like text ? is there a
pointer table ? Or are the elements packed together ?

Is there any advantage in using a smallint[] over an integer[] regarding
size ?

Does a smallint[] with 2 elements really take 12 bytes ?

* On Alignment :

The docs say fields are aligned on 4-bytes boundaries.
Does this mean that several consecutive smallint fields will take 4 bytes
each ?
What about seleral consecutive "char" fields ? 4 bytes each too ?

I ask this because I'll have a lot of columns with small values to store
in a table, and
would like it to be small and to fit in the cache.

Thanks for any info.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Joey Smith 2004-09-10 21:01:42 Interesting performance behaviour
Previous Message Greg Stark 2004-09-10 06:34:28 Re: Multiple Uniques