Hacker Newsnew | comments | show | ask | jobs | submit login

Not sure if you're trolling, but just in case you're not: because any key that has semantic meaning to the data sooner or later is proven to be neither unique, always present nor constant.



If a selected key isn't unique, it's a failure of the data model.

-----


It's a failure of clairvoyance, you mean.

Reality is more complex than any model.

That's why we build models. They are, by their very nature, simpler than reality.

-----


Yeah, true. A model can be valid for some subset of data for some fixed period of time. The real failure is when the model isn't valid even for the defined period. Skill at articulating the limitations and implicit assumptions of any model is far too rare.

-----


That's one thing I found really useful in reading Kimball's books -- the concept of fixed, slowly changing and quickly changing dimensions.

Everything is in flux, and you can choose to model that or not model it.

At the first level, you just model the current state of the system.

Then you begin to model the events that change the current state.

Then you begin to model changes in the shape of the problem domain.

Models all the way down ...

-----


then what is the point of ever having a unique constraint

-----


In case of something that's not a primary key, you can just get rid of it in the future. While technically it is possible to change the PK, it's way too much pain compared to having a synthetic one.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: