How to Recognize the Antipattern
The following quotes can be hints that someone in your organization is about to use the Pseudokey Neat-Freak antipattern.
-
“How can I reuse an autogenerated identity value after I roll back an insert?”
Pseudokey allocation doesn’t roll back; if it did, the RDBMS would have to allocate pseudokey values within the scope of a transaction. This would cause either race conditions or blocking when multiple clients are inserting data concurrently.
-
“What happened to bug_id 4?”
This is an expression of misplaced anxiety over unused numbers in the sequence of primary keys.
-
“How can I query for the first unused ID?”
The reason to do this search is almost certainly to reassign the ID.
-
“What if I run out of numbers?” ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access