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)
 Difference between alter index and Rebuild Index

Author  Topic 

mistiq
Starting Member

1 Post

Posted - 2009-05-25 : 21:16:20
Hi all,

Does anyone know the difference between executing this query:

ALTER INDEX [Index_Name] ON [Table]
REBUILD WITH (ONLINE = OFF);

and using the Rebuild Index option when you right click an index in the object explorer?

I tested it out and found out that if i used the query, the index is actually rebuilt (takes around 12 minutes for a table with 500k+ rows) but if i used the second method which is through the object explorer, the time taken was less than 5 seconds.

Any ideas?

pdset
Constraint Violating Yak Guru

310 Posts

Posted - 2009-05-27 : 20:30:10
Index rebuilding process uses more CPU and it locks the database resources.

The development and Enterprise version has option ONLINE, which can be turned on when Index is rebuilt.

ONLINE option will keep index available during the rebuilding.
Go to Top of Page
   

- Advertisement -