Flexible Server
Like MySQL, Azure Database for PostgreSQL — Flexible Server is the current recommended deployment option. It provides:
- Zone-redundant or same-zone HA
- Burstable compute for dev/test
- Stop/start to pause billing
- Configurable maintenance windows
- VNet integration for private access
- Built-in PgBouncer connection pooler
- PostgreSQL 13, 14, 15, and 16 supported
Service Tiers
| Tier | vCores | Best For |
|---|---|---|
| Burstable | 1–20 | Dev/test, low-traffic applications |
| General Purpose | 2–96 | Most production workloads |
| Memory Optimised | 2–96 | In-memory workloads, high throughput analytics |
High Availability
Same HA options as MySQL Flexible Server:
| HA Mode | SLA | Notes |
|---|---|---|
| Zone-Redundant HA | 99.99% | Primary and standby in different AZs — recommended for production |
| Same-Zone HA | 99.9% | Primary and standby in same AZ |
| No HA | 99.9% | Single server — dev/test only |
Failover is automatic — your connection is briefly interrupted (60–120 seconds for zone-redundant) and then reconnects to the standby (now promoted to primary).
PostgreSQL Extensions
PostgreSQL's extension ecosystem is one of its biggest advantages. Azure Database for PostgreSQL supports many popular extensions:
| Extension | Purpose |
|---|---|
| PostGIS | Geospatial data — store and query geographic objects |
| pg_stat_statements | Track execution statistics for all SQL statements |
| uuid-ossp | Generate universally unique identifiers (UUIDs) |
| pgcrypto | Cryptographic functions within SQL |
| pg_trgm | Trigram matching for text similarity and fuzzy search |
| hstore | Key-value store within PostgreSQL |
| timescaledb | Time-series data (available in some regions) |
-- Enable PostGIS for geospatial queries
CREATE EXTENSION IF NOT EXISTS postgis;
-- Enable uuid-ossp
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Use UUID in a table
CREATE TABLE users (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
name VARCHAR(100)
);
Built-in PgBouncer
PostgreSQL has a connection limit per server. Applications with many concurrent connections (serverless functions, containers) can exhaust this limit. Azure Database for PostgreSQL includes built-in PgBouncer — a connection pooler that maintains a small pool of actual database connections and multiplexes many application connections through them.
Read Replicas
Create up to 5 read replicas in the same or different regions. Useful for:
- Read scaling — run reporting queries against replicas
- Geographic distribution — lower read latency for distant users
- Disaster recovery — promote replica to standalone if primary fails
Logical replication is also supported — stream changes to external subscribers (like a data warehouse).
Creating via CLI
# Create PostgreSQL Flexible Server
az postgres flexible-server create \
--name mypgserver-2026 \
--resource-group myRG \
--location centralindia \
--admin-user pgadmin \
--admin-password "SecureP@ssword123!" \
--sku-name Standard_D2ds_v4 \
--tier GeneralPurpose \
--version 16 \
--storage-size 128 \
--high-availability ZoneRedundant
PostgreSQL vs MySQL on Azure
| Factor | PostgreSQL | MySQL |
|---|---|---|
| SQL compliance | Very high — full SQL standard | Good — some deviations |
| JSON support | Native JSONB — indexed, queryable | JSON type, limited indexing |
| Geospatial | PostGIS — industry standard | Basic spatial types |
| Extensions | Rich ecosystem | Fewer extensions |
| CMS/LAMP use | Less common | Very common (WordPress, Drupal) |
| Choose when | Complex queries, geospatial, advanced SQL | LAMP stack, simpler workloads, existing MySQL apps |