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 2005 Forums
 SQL Server Administration (2005)
 Does rebuild index rebuilds all the indexes?

Author  Topic 

sql_server_dba
Posting Yak Master

167 Posts

Posted - 2011-06-02 : 22:03:47
All,

practical question about indexes...
does rebuilding a clustered index rebuilds all the non-clustered index?
does reorganizing a clustered index reorganizes all the non-clustered indexes?
How much space would be required for rebuilding and reorganizing the indexes?

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2011-06-02 : 22:12:37
No - rebuilding or reorganizing a clustered index does not rebuild the non-clustered indexes. If you drop the clustered index and recreate it, that will force the non-clustered indexes to be rebuilt twice (once when the clustered index is dropped, and again when the clustered index is created).

The general rule is to have 1.5x the size of the index available to rebuild the index.

Jeff
Go to Top of Page

sql_server_dba
Posting Yak Master

167 Posts

Posted - 2011-06-03 : 12:15:36
rebuilding of clustered index drops the index and rebuilds it. So don't you think it rebuilds all the non-clustered indexes?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-03 : 12:24:57
sql server dba, this is documented in BOL. See ALTER INDEX topic, and you'll see that Jeff is right. Only if you select the ALL option will it do what you said.

From BOL:
quote:

Rebuilding a clustered index does not rebuild associated nonclustered indexes unless the keyword ALL is specified.



Reorganize doesn't rebuild them, so it doesn't apply.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -