How many people have ordered the database column types explicitly for better disk packing?
Conversation
Replying to
You mean nulls last? I did on oracle with (ugly) tables with lot of nulls.
Does it make a big difference in PostgreSQL?
dbfiddle.uk/?rdbms=postgre
1
Replying to
Not even that, was strictly reordering common datatypes. Oversimplified, but basically order things as:
ints/dates
shorts
booleans
numeric/text/other
varchar
1
1
I think that it's fairly rare. The example that comes to mind is from Christopher Travers. Apparently Adjust applied this and other low-level optimizations. They were dealing with tens of terabytes of data.
1
4
I've definitely done that in the past when helping out postgres users, to pretty good effect. Both reducing table space and reducing query times (having fixed-width NOT NULL columns first can make tuple deforming a lot faster).
We really ought to make it easier to benefit here.
2
7
Adding another logical pg_attribute attnum (e.g. attorder) would allow that and also allow moving columns (a very popular feature). One could then also drop attisdropped as that could be represented by attorder=-1
1
1
Yea - it's just far from trivial to get this actually working. There've been numerous patches over the years, just never quite getting to the point of being committable.
1
It's easy in theory but hard to get all the details right. Consider how many bugs there has been due to dropped columns over the years.




