How to optimize planned availability group failovers in SQL Server


 

We often perform planned availability group failovers in SQL Server for maintenance, patching, upgrades, and even hardware rotation. Typically, our failovers are fast, but sometimes they take longer – and it’s not always intuitive why, as there are no obvious ties to time of day, database size, or transaction volume.

Shaving even a handful of seconds from the process can improve the application and end user experience; it can also drastically reduce alert noise or, at least, how long alerts have to stay muted. There’s a lot of material out there about performing AG failovers correctly (no data loss), but