Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Why add a clustered index to a table?

Author  Topic 

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2013-07-24 : 11:43:14
Hi guys,

I have a very simple question - "Why add a clustered index to a table"?

When I google it, the resulting pages all show you how to do it, but not why.

I've just been exposed to a database that has lots of tables and none of them have a clustered index.

Should I start adding them? Why? What will it help with?

Please advise.

Thanks in advance!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-07-24 : 14:03:47
It's a good practice to have a clustered index on a table. On Azure, it's mandatory.
The clustered index IS the data in the table. The clustered index controls in which order rows are physically stored in the table.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2013-07-24 : 16:55:54
SwePeso - "a good practice" does not tell me much though. The question is - Why? What will it help with?

Thank you!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-07-24 : 17:37:29
Why? For good database design and for performance reasons.

Good article from Michelle Ufford: https://www.simple-talk.com/sql/learn-sql-server/effective-clustered-indexes/

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2013-07-24 : 17:44:30
Thanks Tara - i'll read it through and come back if i have questions.
Go to Top of Page
   

- Advertisement -