Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
You'll regret using natural keys (ploeh.dk)
5 points by todsacerdoti on June 6, 2024 | hide | past | favorite | 3 comments



I've used natural keys and had no problems at all, over decades.

I think the difference is that my natural keys were keys already, as opposed to numbers to which it seemed possible to add the 'key' trait. The article uses the word 'candidate', candidates are bad IMO. Something that's a candidate isn't a good natural key, it needs to already be a key, and it needs to be a key for the exact thing that's in your table.

Even if the two things 'car' and 'chassis' seem similar, I wouldn't want to risk using that, because the two are similar but not the same, and having to renumber a few years later would be awfully expensive.


Natural keys are fine ... provided your company issues them and controls them completely, and will always do so, law of physics. Otherwise, not so much.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: