Re: Smaller data types use same disk space - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Smaller data types use same disk space
Date
Msg-id CAHyXU0x34oFEGHLwb67oouUusMhvo-YepJhcrV4eJxMOKS=dmw@mail.gmail.com
Whole thread Raw
In response to Re: Smaller data types use same disk space  (Mike Christensen <mike@kitchenpc.com>)
Responses Re: Smaller data types use same disk space  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Smaller data types use same disk space  (Mike Christensen <mike@kitchenpc.com>)
List pgsql-general
On Thu, Jul 26, 2012 at 11:02 AM, Mike Christensen <mike@kitchenpc.com> wrote:
> I don't really think you'd need to decouple the internal column order
> from what the user sees.  A REORDER COLUMNS command should re-build
> the table with the columns in the specified order.  Internally, it
> should be no different from making a new table, copying all the data
> over, then deleting the old table.  If there's any optimizations that
> can be done (such as making this faster on large tables), those could
> be done in future versions.  I'd just like to changing column order
> easier without remaking the table or renaming columns and changing
> their data types (as suggested by Marc)

That's a controversial point: doing it that way makes reordering of
large tables highly impractical.  A column map turns that into a
catalog update which can be done at any time.  I would argue that you
can have it both ways: implement the map and have table rebuilding
operations (like TRUNCATE and CLUSTER) opportunistically do the
physical swap.

merlin

pgsql-general by date:

Previous
From: leo xu
Date:
Subject: Re: how to calculate or know seq_scan scan how many blocks every time
Next
From: Tom Lane
Date:
Subject: Re: Smaller data types use same disk space