Byte Sizes

From: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Byte Sizes
Date: 2004-09-09 12:56:35
Message-ID: opsd18wll2cq72hf@musicbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc


Hello,

* On the size of arrays :

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

My bet would be 4 bytes for number of dimensions, 4 per dimension for the
length, and then the storage requirements of whatever's in the array.

If the array contains fixed size elements like integers, it'd be 4 bytes
per element.
However if it contains 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[] ?

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 ?

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-general by date

  From Date Subject
Next Message Phil Endecott 2004-09-09 12:57:28 MOVE doesn't return number of rows
Previous Message Vic Cekvenich 2004-09-09 12:56:20 Text Search vs MYSQL vs Lucene

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2004-09-09 16:02:14 Re: [JDBC] ERROR: canceling query due to user request
Previous Message Paul Thomas 2004-09-09 10:42:42 Re: [JDBC] ERROR: canceling query due to user request