Friday, June 22, 2012

Good keys, what are they like? « Thomas Kejser's Database Blog

Stupid numeric single-column auto-incrementing identities.  Those are good keys.  In a warehouse model anyway....

However, in SQL, identity columns sometimes do get reused/refilled.
http://stackoverflow.com/questions/6738732/why-are-my-sql-server-identity-values-being-reused

And when using integer identities, be sure that the number of rows do not exceed the limits of integer. 
The max limit is 2,147,483,647.  Hopefully your company is successful enough to get this many sales transactions.

If they're expected to do, use bigint.
The max limit is 9,223,372,036,854,775,807.

Good keys, what are they like? « Thomas Kejser's Database Blog