From: Martijn van Oosterhout <kleptog@svana.org>
To: Paul Mackay <mackaypaul@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Physical column size
Date: Fri, 3 Mar 2006 11:23:58 +0100
Message-ID: <20060303102358.GA17615@svana.org> (raw)
In-Reply-To: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com>
References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com>
<786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com>
On Fri, Mar 03, 2006 at 11:03:24AM +0100, Paul Mackay wrote:
> The end result is that the physical size on disk used by table tmp_A is
> exactly the same as table tmp_B (as revealed by the pg_relation_size
> function) ! Given that a "char" field is supposed to be 1 byte in size and a
> int4 4 bytes, shouldn't the tmp_A use a smaller disk space ? Or is it that
> any value, whatever the type, requires at least 4 bytes to be stored ?
Alignment. An int4 value must start on a multiple of 4 offset, so you
get three bytes of padding. If you put the int4, then the char it
should work better. Although whole rows have alignment requirements
too...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.
Attachments:
signature.asc (application/pgp-signature, 188B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: kleptog@svana.org, mackaypaul@gmail.com, pgsql-general@postgresql.org
Subject: Re: Physical column size
In-Reply-To: <20060303102358.GA17615@svana.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox