I’ve grown up reading Tom Clancy and probably most of you have at least seen Red October, so this book caught my eye when browsing used books for a recent trip. It’s a fairly human look at what’s involved in sailing on a Trident missile submarine…
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).