|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 3:14 AM
Points: 31,
Visits: 186
|
|
Hi All,
I've just inherited a database and whilst doing a health check discovered about 300 tables that don't have clustered indexes. Now anything with zero rows I will ignore and anything with 20,000 rows and above I will immediately investigate to see about slapping on a clustered index. What about the others? Is there a "rule of thumb" ? Eg: Any table with more than 1,000 rows could benefit from a clustered index? What's the tipping point where there's so few rows it's not worth it?
Cheers!
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 1:13 AM
Points: 323,
Visits: 964
|
|
you should have clustered index on every table . that is what they called as best practice.
data is not organized properly in heap tables (tables without clustered index)
http://msdn.microsoft.com/en-us/library/hh213609.aspx http://technet.microsoft.com/en-us/library/cc917672.aspx http://www.simple-talk.com/blogs/2007/12/17/should-you-always-use-a-clustered-index/
----------------------------------------------------------------------------- संकेत कोकणे
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 3:14 AM
Points: 31,
Visits: 186
|
|
Thanks for the textbook answer. Not! Yeah, that's what it says "in the manual", but the reality is that there is a point below which a Clustered Index is more of an overhead than a help. Anyone got a rough rule of thumb for what that point is? 1,000 rows? 5,000 rows?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 1:16 AM
Points: 37,688,
Visits: 29,947
|
|
Stueyd (11/2/2012) What's the tipping point where there's so few rows it's not worth it?
0.
Every table should have a clustered index unless you have a good reason otherwise (low row count is not a good reason)
but the reality is that there is a point below which a Clustered Index is more of an overhead than a help.
No, there isn't.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: 2 days ago @ 3:48 AM
Points: 3,125,
Visits: 4,311
|
|
Having a clustered index on every table is almost always a good idea. However, using a clustered index just for the sake of having a clustered index on a table is not. Clustered indexes are best suited for those columns most frequently used in range-based searches.
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, April 15, 2013 7:02 AM
Points: 320,
Visits: 331
|
|
Here is a link to the MSDN for Clustered Index Design Specifications which may help you better understand what columns you should use for your clustered index.
http://msdn.microsoft.com/en-us/library/ms190639%28v=sql.105%29.aspx
Also, you may want to consider taking a look at the "Stairway to SQL Server Indexes" which explains both clustered and nonclustered indexes
http://www.sqlservercentral.com/stairway/72399/
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 1:16 AM
Points: 37,688,
Visits: 29,947
|
|
Stewart "Arturius" Campbell (11/2/2012) Clustered indexes are best suited for those columns most frequently used in range-based searches.
I would tend to disagree with that, but that's just me.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 1:13 AM
Points: 323,
Visits: 964
|
|
Me too !!
----------------------------------------------------------------------------- संकेत कोकणे
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 1:55 PM
Points: 15,442,
Visits: 9,571
|
|
GilaMonster (11/2/2012)
Stewart "Arturius" Campbell (11/2/2012) Clustered indexes are best suited for those columns most frequently used in range-based searches.I would tend to disagree with that, but that's just me.
Not just you.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 6:14 PM
Points: 31,421,
Visits: 13,734
|
|
|
|
|