Skip to content
Cloud Efficiency Hub

Non-Production PostgreSQL Flexible Servers Running Outside Working Hours

The short version

Development, test, QA and demo servers on Azure Database for PostgreSQL flexible server are usually needed only during working hours, yet many run 24x7 with no stop schedule.

PointFive Research

Cloud cost research at PointFive

Category
Databases
Reference
CER-0444
Type
Inefficient Configuration

Explanation

Why the waste happens and who it affects.

Compute is billed for every hour the server exists in a running state, so a server that is used 40 to 50 hours a week pays for the remaining nights and weekends at the full vCore rate.

Flexible server supports stopping compute on demand, and Microsoft positions stop/start as a cost control for development, testing and time-bound workloads. Stopping once is not enough: a stopped server starts again automatically after seven days, so the savings only persist with a recurring schedule. The waste is spread across many small non-production servers, so it rarely shows up as a single large line item.

Billing model

The pricing dimensions that drive this cost.

Flexible server bills compute, provisioned storage and backup storage as separate line items.

Compute
Billed per vCore-hour while the server is running, with each started hour billed in full; billing stops immediately when the server is stopped
Provisioned storage
Billed per GiB-month whether the server is running or stopped
Backup storage
Free up to 100 percent of provisioned storage, then billed per GiB-month; retained backups continue to be billed while the server is stopped
Automatic restart
A stopped server starts automatically after seven days unless it is started sooner, and compute billing resumes
High availability standby
A zone-redundant HA server is billed for the compute and storage of both the primary and the standby

How to detect

5 checks to find it in your estate.

  • List flexible servers tagged or named as dev, test, QA, staging or sandbox and check the server state; servers that are always Ready indicate no stop schedule
  • Chart the Active Connections (active_connections) and CPU percent (cpu_percent) metrics over several weeks and look for nights and weekends with no application connections or only baseline CPU
  • On each non-production server, open Automation > Tasks and check whether Stop PostgreSQL flexible server and Start PostgreSQL flexible server tasks exist and are enabled
  • Review the Activity Log for stop and start operations; a server that was stopped once and restarted seven days later without a new stop indicates the schedule is missing
  • Note which non-production servers have zone-redundant high availability enabled; each running hour is billed for both primary and standby compute, so they gain the most from a stop schedule

How to fix

5 ways to remove the waste.

  • Create paired automation tasks on each server from the Stop PostgreSQL flexible server and Start PostgreSQL flexible server templates, or use Azure Automation or Logic Apps to stop servers outside working hours; automation tasks run on Logic Apps Consumption pricing, billed per trigger and action execution
  • Make the stop schedule recur at least every few days (for example nightly and at the start of the weekend) so the seven-day automatic restart does not leave servers running
  • When stopping a primary with read replicas, stop the primary before the replicas and start the replicas before the primary, as Microsoft documents for power operations
  • Avoid stopping and starting within the same hour, since each hour a server runs is billed in full
  • For small servers that must stay reachable, consider the Burstable tier instead of stopping, noting that Burstable does not support read replicas, the built-in PgBouncer or on-demand backups

Documentation

Vendor references for pricing and configuration.