Re: alter table type from double precision to real

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: <ssoo(at)siliconfile(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: alter table type from double precision to real
Date: 2007-06-25 08:23:55
Message-ID: 87ps3ke92c.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<ssoo(at)siliconfile(dot)com> writes:

> Real type takes 4 byte storage sizes and double precision takes 8 bytes.
> I altered a data type from double precision to real and vacuumed DB.
> But PostgreSQL's data disk usage did not shrinked.
> And pg_dump size remained same.
> It seems that real takes 8 byte storage sizes.

Keep in mind that vacuum doesn't immediately shorten the table when it finds
free space. It just marks the space as free and available for reuse.

This could also be due to alignment restrictions on the other columns or the
row as a whole. If you're curious exactly what's going on and how to optimize
your table layout send your table definition and we can tell you exactly how
it's being laid out and where the extra 4 bytes are going.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ssoo 2007-06-25 10:57:07 Re: alter table type from double precision to real
Previous Message ssoo 2007-06-25 07:35:52 Re: alter table type from double precision to real