3 ms·
Also pretty sure almost every database with variable width columns has this issue. An old MS SQL Server optimization was to use chars and not have nulls since t
by jabart 4y ago
Also pretty sure almost every database with variable width columns has this issue. An old MS SQL Server optimization was to use chars and not have nulls since that drops a few bits too. That way your table was easy to find row 500 on disk. This was back when SCSI and IDE drives were common though.
Doesn't indexes fix this too? You can index on column 100 which puts in on disk as Column100|PrimaryKey and now it's a really narrow table. Like yeah you shouldn't have a table with 1,500 columns but sometimes you really do need it.
Edit Flipped the index layout.
- masklinn 4y ago> Doesn't indexes fix this too? If your query is such that an index-only scan will fulfil it then yeah, it should.
- sokoloff 4y agoI haven’t looked at the pg source, but wouldn’t an index on Column100 be laid out on disk as Column100|PrimaryKey rather than PrimaryKey|Column100?
- jabart 4y agoOops yeah, got that flipped.