Support for Physical Column Reordering in PG

Started by Srinath Reddy Sadipiralla8 months ago2 messages
#1Srinath Reddy Sadipiralla
srinath2133@gmail.com

Hi,is there any better way to change the order of a column except
1) creating a new table and do insert with select with rearranged columns
2) using views

use case:
there are cases where we might be using delta compression between tuples we
have a table like
"create table temp(x bigint,y char(3),z integer);"
If we have tuple values,for the column y less than 3, SQL standard does
padding to make the length = 3,which causes delta noise,so to reduce this
noise we reposition the column y at the end ,which helps us to reduce the
delta between tuples.

So is making a patch to have a sql command to reposition the column like
other databases makes sense? thoughts ?

--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Srinath Reddy Sadipiralla (#1)
Re: Support for Physical Column Reordering in PG

Srinath Reddy Sadipiralla <srinath2133@gmail.com> writes:

So is making a patch to have a sql command to reposition the column like
other databases makes sense? thoughts ?

There have been multiple attempts over the years to separate
physical and logical column positions. They've failed :-(.
You might trawl the mail list archives for awhile to understand the
problem better. Maybe a determined person could write a successful
patch, but don't underestimate the complexity and risk of introducing
new bugs.

regards, tom lane