• CELKO (12/2/2014)


    It has nothing to do with the physical storage like your silly IDENTITY. A file needs a unique physical storage locator, like a record number.

    In SQL Server, an IDENTITY column is frequently used as a clustered index to control many physical aspects of the underlying file(s). It can prevent massive page splits (which can cause a huge waste of space and major slowdowns when range criteria is used) and, in tables where any natural key is usually a silly attempt (such as a Customer table), it allows for the clustering "key" to meet all the requirements of being unique, narrow, ever increasing, and unchanging. You have to remember that in SQL Server, ALL of the columns of the clustered index will be added to the key columns of ALL non-clustered indexes. Yes, Oracle (for example) works differently than SQL Server. Not every "best practice" works well on every database engine at the file level.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)