Physical column size

From: "Paul Mackay" <mackaypaul(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Physical column size
Date: 2006-03-03 10:03:24
Message-ID: 786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance pgsql-sql

Hi,

I've created a table like this :
CREATE TABLE tmp_A (
c "char",
i int4
);

And another one
CREATE TABLE tmp_B (
i int4,
ii int4
);

I then inserted a bit more than 19 million rows in each table (exactly the
same number of rows in each).

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 ?

Thanks,
Paul

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Gigger 2006-03-03 10:03:33 Re: query timeout
Previous Message Ragnar 2006-03-03 09:59:00 Re: query timeout

Browse pgsql-performance by date

  From Date Subject
Next Message Peter Eisentraut 2006-03-03 10:23:21 Re: Physical column size
Previous Message Greg Stark 2006-03-03 04:01:39 Re: Like 'name%' is not using index

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2006-03-03 10:23:21 Re: Physical column size
Previous Message Ragnar 2006-03-03 09:51:17 Re: Why do I get these results?????