3 ms·
In some db storage engines like sqlite and innodb there is no way to lookup the storage location in a heap because the table itself is an index using the primar
by SigmundA 4y ago
In some db storage engines like sqlite and innodb there is no way to lookup the storage location in a heap because the table itself is an index using the primary key always. This is normally called an index organized table or clustered index. Some db engines like MS SQL Server and Oracle allow you to choose if a table is index organized or just a heap. Postgres give you no choice, tables are always heaps.
If the table is index organized then the very common operation of looking up a row by primary key is a single operation and there is no duplication of primary key columns in a separate index which can save significant space on narrow tables with only pk indexes. However secondary index must store the columns in the pk to identify the row and must do two index transversals to find the row vs storing a physical row location and jumping there.
I like having the choice of table layout and use clustered indexes more than not so would prefer them if I had no choice, vs PG having no option for a true IOT.