Re: Re-order columns? - Mailing list pgsql-admin

From Stephen Frost
Subject Re: Re-order columns?
Date
Msg-id 20200729212039.GT12375@tamriel.snowman.net
Whole thread Raw
In response to Re: Re-order columns?  (Holger Jakobs <holger@jakobs.com>)
List pgsql-admin
Greetings,

* Holger Jakobs (holger@jakobs.com) wrote:
> Actually, the order of columns is of _no_ importance, since columns are identified by name and not by column number.
It'sthe 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
rootedin 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

Attachment

pgsql-admin by date:

Previous
From: Olivier Gautherot
Date:
Subject: Re: Re-order columns?
Next
From: Sidney Aloisio Ferreira Pryor
Date:
Subject: RE: How can i be certain autovacuum is causing reuse if table still grows