Quantcast
Channel: Native primary key or auto generated one? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Native primary key or auto generated one?

$
0
0

As a rule is it better to use native primary keys (ie existing columns or combination of columns) or set your primary key to an auto generating row of integers?

EDIT:
It has been pointed out to me that this very similar to this question.

The consensus here is to use surrogate keys, which was my natural inclination, but my boss told me I should also use natural keys where possible. His advice may be best for this particular application, as Name in row uniquely identifies it and we have a need to maintain the ability to view old data, thus any changes to the name/rule is going to mean new unique row.

While the answers here are all helpful, most of them are based on the subjective "here is what you should", and do not cite supporting sources. Am I missing some essential reading or are the best practices database design highly subjective and/or application dependent?


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images