It's very interesting to me that we have to keep telling people this, but it hasn't become part of the "hive folk knowledge" we all seem to develop. I think DB vendors have been sleeping on an opportunity to encourage better practices.
DB vendors haven't done enough to offer ID generation as a core part of their system. Ideally "what ID do I use for this object" shouldn't even be a consideration, because of course the database should handle it. It is the system of record after all. Yet your options are pretty much limited to UUID or a basic incremental counter that fails to meet any real world production constraints.
Basic incremental counters work for most real world production constraints.
Most people are not going to create tables with 4.2 billion rows, even with failed inserts.
If you are doing that its an extreme of either very much you know what you are doing, or you very much do not; I have seen both in production.
Because we keep telling people the opposite in academic settings, where the pkey is usually some actual data field(s) you expect to be unique. There's some point to teaching 3NF this way, but it shouldn't be taken literally.
paxys|1 year ago
hobs|1 year ago
paperplatter|1 year ago