An Azure managed PostgreSQL database service for app development and deployment.
Hi Adrian Pitic,
thanks for the details.
What’s happening here is expected behavior for Azure Database for PostgreSQL maintenance, even when you have High Availability enabled. During a planned maintenance:
• Azure patches the standby first
• then triggers a planned failover so the newly-patched standby becomes primary
• finally patches the former primary
That failover step does cause a brief interruption (typically a few seconds), and if the standby isn’t healthy at maintenance time, Azure will patch the primary directly—resulting in the few-minute outage you saw. You can’t completely avoid downtime, but you can minimize it. Here’s what you can do:
- Verify and maintain a healthy standby
- Make sure you’re using zone-redundant HA (multiple availability zones)
- Monitor the standby’s replication lag and health so it’s ready to take over
- Use Flexible Server with a custom maintenance window
- Set a window during your off-peak hours
- Custom windows only apply to regular updates—critical or emergency patches may override them
- Set up Azure Service Health notifications
- You’ll get alerts 5 days before regular maintenance and when it starts/completes
- Add retry logic in your application
- Handle transient failures during failover gracefully
- If you need truly near-zero downtime
- Consider creating a read replica in another region or a Hyperscale (Citus) cluster
- You can patch the replica, promote it, and switch your applications over with minimal disruption
Let me know if you’d like more detail on any of these steps or help verifying your HA/standby health!
Reference docs:
• Managed schedule maintenance for Azure PostgreSQL Flexible server
• Azure Database for PostgreSQL (PaaS) – High availability architecture
• Scheduled maintenance in Azure Database for PostgreSQL flexible servers
• Planned maintenance in Azure Databases for PostgreSQL - Single Server
https://docs.microsoft.com/azure/postgresql/concepts-planned-maintenance-notification