2026-07-04
Link: https://use-the-index-luke.com/blog/2014-01/unreasonable-defaults-primary-key-clustering-key
HN Discussion: 1 points, 0 comments
Markus Winand's use-the-index-luke.com is one of the most quietly influential resources on the internet for anyone who touches a relational database. It's the companion site to SQL Performance Explained, and this particular post tackles a design choice that most developers never question: why is the primary key almost always the clustering key by default?
On engines like SQL Server and MySQL/InnoDB, tables are physically stored in primary-key order (a "clustered index"). Every non-clustered index then stores the primary key as its row pointer rather than a direct heap address. Winand's argument, based on the URL and title, is that this default is unreasonable: every secondary index inherits the width of the primary key, and every lookup through a secondary index pays an extra B-tree traversal to reach the actual row. On a table with a wide composite PK or a UUID, this "clustered index penalty" compounds across every additional index you add.
Why this matters for a technical audience:
Although the post is from 2014, the underlying trade-offs haven't changed — if anything, they've become more relevant as UUIDv7 and ULIDs push developers toward wider primary keys. It's the kind of foundational database content that ages extremely well, and the reason use-the-index-luke keeps getting re-shared: it explains why your query is slow, not just how to add another index.
