Skip to main content

Azure Database for PostgreSQL & MySQL

Azure Database for PostgreSQL

Deployment Options

OptionDescription
Flexible ServerRecommended. Zone-redundant HA, burstable compute, stop/start.
Single ServerDeprecated — migrate to Flexible Server

Key Features

  • Versions: PostgreSQL 13, 14, 15, 16
  • Compute tiers: Burstable, General Purpose, Memory Optimized
  • Storage: Up to 16 TB, auto-grow supported
  • HA: Zone-redundant with automatic failover
  • Read replicas: Up to 5 replicas, cross-region supported
  • Extensions: pg_stat_statements, pgcrypto, PostGIS, many more

Connection Example

-- Connect via psql
psql "host=myserver.postgres.database.azure.com port=5432 dbname=mydb user=myadmin password=<YOUR_PASSWORD> sslmode=require"

-- Check version
SELECT version();

-- Enable useful extensions
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
🎯 Exam Focus

For DP-300, know that Flexible Server is the recommended deployment for PostgreSQL. Single Server is deprecated. Key differentiator: Flexible Server supports stop/start capability for cost savings.

Azure Database for MySQL

Deployment Options

OptionDescription
Flexible ServerRecommended. Same-zone and zone-redundant HA.
Single ServerDeprecated — migrate to Flexible Server

Key Features

  • Versions: MySQL 5.7, 8.0
  • Compute tiers: Burstable (B-series), General Purpose, Business Critical
  • Storage: Up to 16 TB, auto-grow
  • HA: Same-zone and zone-redundant options
  • Read replicas: Up to 5, cross-region supported
  • Data-in replication: Replicate from external MySQL to Azure

MySQL Performance Tuning Parameters

-- Key server parameters to tune
-- slow_query_log = ON
-- long_query_time = 2
-- innodb_buffer_pool_size = ~70-80% of available memory
-- max_connections = based on tier (default varies)

-- Check slow query status
SHOW VARIABLES LIKE 'slow_query_log';
SHOW VARIABLES LIKE 'long_query_time';
🏢 Real-World DBA Note

When migrating from on-prem MySQL, use Azure Database Migration Service (DMS) for minimal downtime. For PostgreSQL, you can also use pg_dump/pg_restore for smaller databases.

Comparison: PostgreSQL vs MySQL on Azure

FeaturePostgreSQL FlexibleMySQL Flexible
HAZone-redundantSame-zone + Zone-redundant
Max Storage16 TB16 TB
Read ReplicasUp to 5Up to 5
Stop/Start
Backup Retention7-35 days7-35 days
VNET Integration
Private Link

Flashcards

What is the recommended PostgreSQL deployment on Azure?
Click to reveal answer
Flexible Server. Single Server is deprecated.
1 / 6

Quiz

Q1/3
0 correct
Which PostgreSQL deployment option is recommended for new workloads on Azure?