Re: fixed size columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein(at)varlena(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: fixed size columns
Date: 2003-04-30 04:55:51
Message-ID: 19851.1051678551@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

elein <elein(at)sbcglobal(dot)net> writes:
> I have a very long, very narrow table that is taking up a few gigabytes.
> The table is defined with varchar(n) fields and some character(n) fields.
> I am assuming that the majority of all fields are filled.

> Are these rows being stored on disk as aligned varlenas? Can I squish out some
> space by arranging the columns to groups of 8 bytes? Or is each column
> aligned separately on a new 8 byte boundary? Or is this a futile exercise?

Those fields will be aligned on 4-byte boundaries within a row.
Depending on your machine architecture, the total length of a row might
be constrained to an 8-byte multiple or a 4-byte multiple.

My guess is that you'd be spending your time more productively by
figuring a way to make the table less narrow. PG's 28-or-more-byte
overhead per row is usually bad news for narrow table designs, long
before you worry about alignment.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2003-04-30 05:03:17 Re: dump/restore to 7.4devel giving "[archiver (db)] error returned by PQputline"
Previous Message Tom Lane 2003-04-30 04:22:40 Re: qsort (was Re: Solaris)