Quantcast
Channel: Picking the best primary key + numbering system - Stack Overflow
Browsing all 14 articles
Browse latest View live

Answer by harley.333 for Picking the best primary key + numbering system

First off, option 2 is the absolute worst option. As an Index, it's a string, and that makes it slow. And it's generated based on business rules - which can change and cause a rather large...

View Article



Answer by isntn for Picking the best primary key + numbering system

I hope you will agree with me that every design element should have single purpose. Question is what do you think is purpose of PK? If it is to identify unique record in a table, then surrogate keys...

View Article

Answer by Curtis Batt for Picking the best primary key + numbering system

I suspect that you really should use option #3, as many here have already said. Surrogate PKs (either Integers or GUIDs) are good practice, even if there are adequate business keys. Surrogates will...

View Article

Answer by jwolly2 for Picking the best primary key + numbering system

I think the important thing to remember here is that each table in your database/design might have multiple keys. These are the Candidate Keys.See wikipedia entry for Candidate KeysBy definition, all...

View Article

Answer by tvanfosson for Picking the best primary key + numbering system

I would go with the surrogate key, but you may want to have a computed column that "formats" the surrogate key into a more "readable" value if that improves your reporting. The computed colum could...

View Article


Answer by David Robbins for Picking the best primary key + numbering system

While natural keys may have great meaning to the business users, if you do not have the agreement that those keys are sacred and should not be altered, you will more than likely be pulling your hair...

View Article

Answer by wentbackward for Picking the best primary key + numbering system

As mentioned before, keep your internal primary keys as just keys, whatever the most optimal datatype is on your platform. However you do need to let the numbering system argument be fought out, as...

View Article

Answer by cletus for Picking the best primary key + numbering system

This is really a discussion about surrogate (also called technical or synthetic) vs natural primary keys, a subject that has been extensively covered. I covered this in Database Development Mistakes...

View Article


Answer by JohnFx for Picking the best primary key + numbering system

Don't put meaning into your PK fields unless...It is 100% completely impossible thatthe value will never change and thatNo two people would ever reasonablyargue about which value should beused for a...

View Article


Answer by sipsorcery for Picking the best primary key + numbering system

I'm also very strongly in the "don't use primary keys as meaningful data" camp. Every time I have contravened that policy it has ended in tears. Sooner or later the meaningful data needs to change and...

View Article

Answer by MadCoder for Picking the best primary key + numbering system

Another thing to keep in mind is that if you're importing alot of data into this system, you may find out that things like Road_Number are not as unique as you thought, and there may be operational...

View Article

Answer by dkretz for Picking the best primary key + numbering system

Follow the Don't Use policy.Some problems you can run into:You need to generate keys from more than one host.Someone will want to reserve contiguous numbers to use together.How meaningful will people...

View Article

Answer by TheTXI for Picking the best primary key + numbering system

I would personally say keep it simple and stay with an autoincremented primary key. If you need something more "Readable" in terms of display in the program, then possibly one of your other ideas, but...

View Article


Image may be NSFW.
Clik here to view.

Picking the best primary key + numbering system

We are trying to come up with a numbering system for the asset system that we are creating, there has been a few heated discussions on this topic in the office so I decided to ask the experts of...

View Article
Browsing all 14 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>