Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Overusing Identities

By Steve Jones,

http://www.agiledata.org/images/dm101NotationSummary.gifI saw a post on Aaron Bertrand's blog recently about a bad habit to kick in building your tables. He choose using an identity column on every table as a habit that you should avoid. I clicked the link, expecting to disagree with Aaron since I tend to use identity columns quite liberally throughout my designs. I was glad to see Aaron admit that he uses them as well.

The post has some good advice about where we might be overusing identities, though I'm not sure I agree with the idea that a OrderDetails table doesn't need one. I've had places where you order additional quantities, ship separately, re-order on the same order, etc. that make having a simple  handle to that particular row nice. But in general I agree with Aaron.

But is overusing of identity a big problem? I tend to see most people building databases as beginning to intermediate data modelers. I'd probably include myself in that group as well, and rather than have them get confused about what a good natural key is, or building a complicated complex key, I think the default practice of just sticking a surrogate identity column on the table as the PK is a good idea. It's simple, and in the absence of knowing better, or having a reason not to do it, I think it's a good practice.

That doesn't mean that every table has to have an identity, and you certainly should make an effort to improve your modeling skills over time. Learn when it might not be appropriate, and build better models. Read posts like Aaron's and think about the consequences of adding in columns to your design that don't serve a purpose.

However I'll stand by the general rule. If you're in doubt, add that identity or GUID column as the PK. It will likely make life easier.

Steve Jones


The Voice of the DBA Podcasts

Everyday Jones

The podcast feeds are available at sqlservercentral.mevio.com. Comments are definitely appreciated and wanted, and you can get feeds from there.

You can also follow Steve Jones on Twitter:

Overall RSS Feed: or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

Total article views: 293 | Views in the last 30 days: 2
 
Related Articles
ARTICLE

Podcast Announcements

Podcast Feeds

FORUM

identity column

identity column

FORUM

Issues in Identity Column

Issues in Identity Column

FORUM

Identity column

Is identity column a good idea?

BLOG

Podcasting

A new video setup is on the way!!!! Actually I'll do a couple podcasts on podcasting over the hol...

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones