Sometimes… Josh Berkus has some enlightening posts about the use of Surrogate Primary Keys in database design:
Which I discovered by following this thread for a while:
Basically a surrogate key, in it’s most common incarnation, is the auto-incremented integer id that uniquely identifies a row in a table and is usually the primary key. It’s a surrogate when another column or combination of columns also uniquely identifies the row and is therefore the actual primary key. For instance a ‘user’ table that requires each user to have a unique login_name and then also assigns a unique user_id. The login_name is the actual primary key, the user_id is a surrogate.
I hadn’t thought about my frequent use of surrogate keys until now, and by extension the general acceptance of their necessity, even their requirement in many frameworks (like Ruby-on-Rails) and object-relational mappings.
Good wake-up call.