Last updated: May 2026
Azure DatabasesBeginnerAZ-104⏱ 11 min read

Azure Database for PostgreSQL

Azure Database for PostgreSQL is a fully managed PostgreSQL service. PostgreSQL is the most feature-rich open-source relational database — with advanced SQL support, JSON querying, geospatial capabilities (PostGIS), and a rich extension ecosystem. Azure's managed service makes it enterprise-ready with built-in HA, automated backups, and security.

What you'll learn Flexible Server architecture · Service tiers · High availability (zone-redundant) · PostgreSQL extensions support · Built-in PgBouncer connection pooling · Read replicas · Logical replication · Creating via CLI · PostgreSQL vs MySQL

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

TiervCoresBest For
Burstable1–20Dev/test, low-traffic applications
General Purpose2–96Most production workloads
Memory Optimised2–96In-memory workloads, high throughput analytics
ℹ️
Memory Optimised Tier PostgreSQL Flexible Server has a Memory Optimised tier (not found in MySQL Flexible Server). This provides more RAM per vCore — ideal for large working sets, complex queries, and analytics workloads that benefit from keeping more data in memory.

High Availability

Same HA options as MySQL Flexible Server:

HA ModeSLANotes
Zone-Redundant HA99.99%Primary and standby in different AZs — recommended for production
Same-Zone HA99.9%Primary and standby in same AZ
No HA99.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:

ExtensionPurpose
PostGISGeospatial data — store and query geographic objects
pg_stat_statementsTrack execution statistics for all SQL statements
uuid-osspGenerate universally unique identifiers (UUIDs)
pgcryptoCryptographic functions within SQL
pg_trgmTrigram matching for text similarity and fuzzy search
hstoreKey-value store within PostgreSQL
timescaledbTime-series data (available in some regions)
SQLEnable an extension
-- 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.

💡
Connection Pooling Instead of each of your 1,000 application connections opening a direct PostgreSQL connection, PgBouncer maintains e.g. 100 connections to PostgreSQL and routes all 1,000 app connections through them. This dramatically reduces connection overhead and is essential for serverless and microservices architectures.

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

Azure CLICreate PostgreSQL Flexible Server
# 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

FactorPostgreSQLMySQL
SQL complianceVery high — full SQL standardGood — some deviations
JSON supportNative JSONB — indexed, queryableJSON type, limited indexing
GeospatialPostGIS — industry standardBasic spatial types
ExtensionsRich ecosystemFewer extensions
CMS/LAMP useLess commonVery common (WordPress, Drupal)
Choose whenComplex queries, geospatial, advanced SQLLAMP stack, simpler workloads, existing MySQL apps
💡
AZ-104 Exam Tip Know PostgreSQL Flexible Server supports Memory Optimised tier (MySQL does not). Know PostGIS for geospatial. Know built-in PgBouncer for connection pooling. Know that PITR restores create a new server (same as MySQL).
📝 Practice Questions
Click an option to check your answer.
Q1. A developer needs to store and query geographic data (locations, distances, polygons) in Azure. Which database + extension is best?
A — Azure SQL Database with built-in spatial types
B — Azure Database for PostgreSQL with PostGIS extension
C — Azure Cosmos DB with Gremlin API
D — Azure Cache for Redis
Q2. What problem does built-in PgBouncer solve in Azure Database for PostgreSQL?
A — Encrypts data in transit between applications and the database
B — Manages connection pooling to prevent connection exhaustion from many application clients
C — Replicates data to secondary regions
D — Caches query results for faster response times
Q3. Which service tier is unique to Azure Database for PostgreSQL Flexible Server (not available in MySQL Flexible Server)?
A — Burstable
B — General Purpose
C — Memory Optimised
D — Business Critical
Q4. How many read replicas can you create for Azure Database for PostgreSQL?
A — Up to 5
B — Up to 3
C — Up to 10
D — Unlimited
Q5. When should you choose PostgreSQL over MySQL for an Azure-hosted application?
A — When building a WordPress website
B — When needing complex queries, geospatial support, JSON data, or strict SQL compliance
C — When building a PHP application
D — When you need the cheapest possible database
Comments
Disclaimer: RedKite Cloud is an independent educational resource and is not affiliated with Microsoft Corporation.