Tuesday, October 18, 2005

Does it matter if I build the clustered index before/after rebuilding the non-clustered indexes?

I was reading a QA on one of Kimberley's great sessions when I came across this interesting question and even more interesting answer. I had always been told that a rebuild of your clustered index causes a rebuild of your non clustered indices, apparently it needs to be more refined.


Does it matter if I build the clustered index before/after
rebuilding the non-clustered indexes?


You should always create the clustered index before creating non-clustered
index but as for rebuilding - you can rebuild your indexes independently as a
rebuild of the clustered does not (generally) cause a rebuild of the
non-clustered. There is one exception to this rule in SQL Server 2000 – in 2000
ONLY, SQL Server will automatically rebuild the non-clustered indexes when a
non-unique clustered index is rebuild. Why? Because the uniqueifiers are
rebuilt.


1 comment:

WesleyB said...

@fretn: ge staat zelfs in m'n blogrolling stuff nu :)

@broq: jot poging tot volhouden lukt voorlopig goed :p Vooral omdat ik het ook als persoonlijk geheugensteuntje zie.