Quantcast
Channel: When to use an auto-incremented primary key and when not to? - Stack Overflow
Browsing latest articles
Browse All 9 View Live

Answer by Krusty the Clown for When to use an auto-incremented primary key...

One other thing I haven't seen mentioned is you're potentially exposing statistics you may not want to. For example, when this question was written, it was (give or take) the 2,186,260th one posted on...

View Article



Answer by Simon for When to use an auto-incremented primary key and when not to?

Old topic I know, but one other thing to consider is that given that most RDBMSes lay out blocks on disk using the PK, using an auto-incrementing PK will simply massively increase your contention. This...

View Article

Answer by Jay for When to use an auto-incremented primary key and when not to?

This is a highly debated question, with lots of emotion on both sides.In my humble opinion, if there's a good, useable natural key available -- like an ISBN -- I use it. I'm going to store it on the...

View Article

Answer by Klaus Byskov Pedersen for When to use an auto-incremented primary...

With regards to using ISBN and SSN you really have to Think about how many rows in other tables are going to reference these through foreign keys because those ids will take up much more space than an...

View Article

Answer by Rob Goodwin for When to use an auto-incremented primary key and...

The main problem that I have seen with the auto incrementing an integer approach is when you export your data to bring into another db instance, or even an archive and restore operation. Because the...

View Article


Answer by Keith Adler for When to use an auto-incremented primary key and...

I'm trying to figure out the "best practices" for deciding whether or not to add an auto-incrementing integer as the primary key to a table.Use it as a unique identifier with a dataset where the PKey...

View Article

Answer by Craig Warren for When to use an auto-incremented primary key and...

You've got the idea right there.Auto-increment should be used as a unique key when no unique key already exists about the items you are modelling. So for Elements you could use the Atomic Number or...

View Article

Answer by Pablo Santa Cruz for When to use an auto-incremented primary key...

There are a lot of already addressed questions on Stack Overflow that can help you with your questions. See here, here, here and here.The term you should be looking for: surrogated keys.Hope it helps.

View Article


When to use an auto-incremented primary key and when not to?

I'm trying to figure out the "best practices" for deciding whether or not to add an auto-incrementing integer as the primary key to a table.Let's say I have a table containing data about the chemical...

View Article

Browsing latest articles
Browse All 9 View Live




Latest Images