Reasons not to have a clustered index in SQL Server 2005

前端 未结 5 1473
孤城傲影
孤城傲影 2020-12-09 06:21

I\'ve inherited some database creation scripts for a SQL SERVER 2005 database.

One thing I\'ve noticed is that all primary keys are created as NON CLUSTERED

5条回答
  •  借酒劲吻你
    2020-12-09 06:54

    On any "normal" data or lookup table: no, I don't see any reason whatsoever.

    On stuff like bulk import tables, or temporary tables - it depends.

    To some people surprisingly, it appears that having a good clustered index actually can speed up operations like INSERT or UPDATE. See Kimberly Tripps excellent The Clustered Index Debate continues.... blog post in which she explains in great detail why this is the case.

    In this light: I don't see any valid reason not to have a good clustered index (narrow, stable, unique, ever-increasing = INT IDENTITY as the most obvious choice) on any SQL Server table.

    To get some deep insights into how and why to choose clustering keys, read all of Kimberly Tripp's excellent blog posts on the topic:

    http://www.sqlskills.com/BLOGS/KIMBERLY/category/Clustering-Key.aspx

    http://www.sqlskills.com/BLOGS/KIMBERLY/category/Clustered-Index.aspx

    Excellent stuff from the "Queen of Indexing" ! :-)

提交回复
热议问题