SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Can I pause or resume an index rebuild operation?

One of the cool new features in SQL Server 2017 (and currently also in public preview in Azure SQL Database) is the option to pause and resume an online index rebuild operation.

This option can be useful for several use cases. Imagine you have a very large index, which takes approximately 5 hours to rebuild online. A lot of things can happen during those 5 hours.

For a start, you might not have enough time within your maintenance window to complete the operation. Now you can configure the operation to run for 3 hours and then pause automatically. You can then resume the operation during the next maintenance window. Of course, this means that SQL Server will have to maintain both old and new indexes until the new index is completely ready. But depending on your workload and policy, this might be a better option than to continue to rebuild the index outside of the maintenance window.

Another interesting use case is when the rebuild operation fails after 4 hours out of 5. It might fail because the disk is full or because there was a failover of the database to another replica or because of some other error. If you started the online index rebuild operation in resumable mode, then all the work that was performed during those 4 hours is not lost. You can simply resume the operation in the new replica (or after you free some disk space).

For more information, see ALTER INDEX and Guidelines for Online Index Operations.

The post Can I pause or resume an index rebuild operation? appeared first on Madeira Data Solutions.

Guy Glantser

Guy Glantser, Data Platform MVP, is the leader of the Israeli PASS chapter and also the CEO and founder of Madeira Data Solutions. His career has been focused on the Microsoft Data Platform for the past 20 years, performing various database roles as either an on-site DBA, an external consultant or a speaker. Guy is involved in many activities in the Microsoft Data Platform community. He occasionally speaks at community events, such as PASS Summit, SQLBits, SQL Saturdays and user groups around the world. He also co-hosts the SQL Server Radio podcast.


Leave a comment on the original post [www.madeiradata.com, opens in a new window]

Loading comments...