Hacker News new | ask | show | jobs
by jack_squat 1124 days ago
I also tend toward surrogate keys, and would also point out that the overhead concerns frequently weigh in favor of them as well (though not always).

If your natural key is bigger than the appropriately sized surrogate key, and it will be referenced across the database in other tables, the overhead of referencing it everywhere (and indexing it in those places -- potentially in much larger tables) can easily outweigh the overhead of the extra bytes on the original table.

Additionally, surrogate keys can realize much better performance WRT cache locality.