top of page
Writer's pictureGuy Glantser

Can I Pause and Resume an Index Rebuild Operation?

One of the cool features introduced in SQL Server 2017 (and also in Azure SQL) 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. 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).


In SQL Server 2019, this capability was enhanced to include also online index build operations (new indexes) in addition to online index rebuild operations.


For more information, see Guidelines for Online Index Operations.

0 comments

Recent Posts

See All

Comments


STAY IN TOUCH

Get New posts delivered straight to your inbox

Thank you for subscribing!

bottom of page