3 ms·
Codd was pretty adamant in his original papers that keys should be made up from data rather than a unique integer, and his example of converting from a hierarch
by dnlhg 5y ago
Codd was pretty adamant in his original papers that keys should be made up from data rather than a unique integer, and his example of converting from a hierarchical database schemas to a relational database schema shows how compound, natural keys are important to represent relationships. But we don’t usually do it that way today, partly because it isn’t that practical with our current databases and ORMs. It has some theoretical advantages and disadvantages, but using IDs seems to work well enough that we’re not investing in a new paradigm.
- wwweston 5y agoYeah, I think the early proponents of relational models had a lot to do with setting the culture here. I suspect that some of this has to do with an insight I recently discovered: a "natural" key is in some sense a key that's so foreign it's in a "database" you don't control. And if you establish a culture that converges on natural keys, you may end up with more easily cross-operable databases/collections as an asset. And this is why I think it's probably dead. If the boring practicality of generated identifiers didn't do it, laws like the CCPA which are going to, because they recognized the potential of broad cross-operable data to be a liability and a hazard vs an asset.
- whatshisface 5y agoThose "natural" databases as a rule are going to be full of duplicates and sometimes even inconsistencies, hence the need for IDs that only exist for the purpose of expressing relationships within your own database. Basically, pointers.
- CRConrad 5y agohttps://news.ycombinator.com/item?id=27658993 https://news.ycombinator.com/item?id=27658993
- ARandumGuy 5y agoIn practice, using a unique IDs is often not ideal, but it also rarely the wrong choice. I've personally never heard of a scenario where a unique ID caused difficult to fix issues (although I'm sure it's possible). In contrast, a poorly though out natural key can cause a lot of headaches. This mostly occurs when your natural key isn't as unique as you thought, or if you have to change what you use as a natural key. The real world does not like to conform to our database constraints.
- goto11 5y agoCodd actually use a synthetic identifier for employee ID in an example in the original paper. So I don't think he is against synthetic identifiers in principle. But if a natural key exist of course a synthetic key need not be introduced.