SQL: Rebuild or Reorganize Indexes?

The query below 1 can be used to identify those indexes that should be rebuilt (using ALTER INDEX REBUILD WITH (ONLINE = ON), or those that should be reorganized (USING ALTER INDEX REORGANIZE):

This information was obtained from http://msdn.microsoft.com/en-us/library/ms189858.aspx, but I have enhanced the query to return the table name and a “suggestion”.

  1. Please ensure you test any script taken from my website on a test/development machine, before running on a production server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

CJayMead's SQL Server, Endeca, MS Office Help © 2018