Compare

Side-by-side on the decisions that recur: index vs scan, normalize vs denormalize, optimistic vs pessimistic, partition vs shard, and more — with when to choose each.

Heap table + secondary indexes (PostgreSQL-style)Clustered primary index (InnoDB-style)
Where rows liveunordered heap pages; every index points at a TID (page, slot)in the leaves of the primary-key B+ tree, sorted by PK
Secondary lookupindex → TID → heap page (2 structures, 1 hop)index → PK → clustered tree (2 descents)
PK range scanindex leaves, then random heap reads unless clusteredphysically sequential in the leaf chain
UPDATE of non-key columnnew tuple version; every index needs a new entry unless HOTin place (with undo); secondary indexes untouched
PK choicematters little for layoutrandom UUIDs cause splits everywhere; PK size is copied into every secondary index
Bulk loadappend to heap, build indexes aftersorted by PK is fast; random PK is slow
Choose this whenWide tables with many secondary indexes, heavy updates on non-key columns, bulk loads — and PostgreSQL.Primary-key range access, small monotonically increasing keys, workloads where PK locality dominates — and MySQL/InnoDB.