Re: Re-order columns?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Holger Jakobs <holger(at)jakobs(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Wells Oliver <wells(dot)oliver(at)gmail(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Re-order columns?
Date: 2020-07-29 21:20:39
Message-ID: 20200729212039.GT12375@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Greetings,

* Holger Jakobs (holger(at)jakobs(dot)com) wrote:
> Actually, the order of columns is of _no_ importance, since columns are identified by name and not by column number. It's the same as the order of rows in a table - undefined (unless you use order by).
>
> That columns appear to have some kind of order and show in tools with a stable order has technical reasons and is not rooted in relational theory.

There's very practical reasons to think about the ordering of columns,
at least in PostgreSQL- you can end up creating holes in your row if you
order the columns in the wrong way and that can lead to wasted space.

There was a patch floating around to allow re-ordering, which would also
then allow us to re-order the row underneath to avoid wasting space (as
much as possible, anyway) which would be really rather nice, but sadly
it didn't get enough push on it to make it happen.

Thanks,

Stephen

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Sidney Aloisio Ferreira Pryor 2020-08-03 21:36:10 RE: How can i be certain autovacuum is causing reuse if table still grows
Previous Message Olivier Gautherot 2020-07-29 21:18:10 Re: Re-order columns?