Skip to article
Databases Azure Database for PostgreSQL

PostgreSQL database

A named PostgreSQL catalog inside a flexible server that holds schemas, tables, extensions, permissions, and application data.

Source: Microsoft Learn - az postgres flexible-server db Reviewed 2026-05-19

Exam trap
Using the default postgres database for application tables because it was available during a quick prototype.
Production check
List databases and confirm the target name, charset, and collation before a migration.
Article details and learning context
Aliases
PostgreSQL database, postgresql database, Azure Database for PostgreSQL database, database catalog, schema migration, charset, collation
Difficulty
fundamentals
CLI mappings
5
Last verified
2026-05-19

Understand the concept

In plain English

A PostgreSQL database is the named container where your actual application data lives. In Azure Database for PostgreSQL flexible server, the server is the managed Azure resource, while each database inside it holds schemas, tables, functions, indexes, extensions, and permissions. A server can host multiple databases, but they still share the same compute, storage, network configuration, backup window, and administrative boundary. That makes database naming and separation important: putting two workloads on one server may be convenient, but it also ties their performance, maintenance, and recovery choices together.

Why it matters

A PostgreSQL database matters because it is the unit developers connect to and the place operators must protect during migrations, releases, and restores. Many outages happen when a deployment targets the wrong database, a migration runs against a shared database, or a team assumes database-level separation protects them from server-level limits. In Azure, backup and high availability are primarily server capabilities, so one database can be affected by server maintenance, scaling, or network changes made for another workload. Good database boundaries make ownership, permissions, schema change control, and incident response clearer. Bad boundaries create hidden coupling that only appears during performance pressure or recovery.

Official wording and source

A PostgreSQL database in Azure Database for PostgreSQL flexible server is a named database inside a managed server instance. Each database stores schemas, tables, functions, indexes, and data for one workload or boundary, while Azure manages the hosting server, backups, compute, storage, and networking.

Open Microsoft Learn

Technical context

This term sits inside the PostgreSQL data plane and below the Azure resource plane. Azure creates and manages the flexible server resource, but database objects are managed through PostgreSQL commands, CLI database operations, tools such as psql or pgAdmin, and deployment scripts. The database is where schemas, users, extensions, collations, and application tables are organized. Azure CLI can list, create, show, or delete databases on a flexible server, while deeper permissions and objects usually require SQL. The database shares server-level networking, backup, high availability, monitoring, and compute limits.

Exam context

Compare with

Where it is used

Where you see it

  1. In the Azure portal database list or CLI db output, each database appears under a flexible server with charset and collation details during inventory checks.
  2. In connection strings and application settings, the database name selects which PostgreSQL catalog the application opens after authentication succeeds during runtime configuration review and troubleshooting.
  3. In migration pipelines, schema tools target a database explicitly before applying DDL, seed data, extensions, or version tracking tables during release validation windows for readiness.

Common situations

  • Separate application schemas into named databases while keeping related workloads on one managed PostgreSQL server.
  • Create a clean migration target database before importing data from on-premises PostgreSQL or another cloud.
  • Inventory databases on a shared server to assign owners, cleanup candidates, and migration responsibilities.
  • Validate that release pipelines target the intended database before running destructive schema changes.
  • Compare database growth and query behavior to decide when a workload needs its own flexible server.

Illustrative Azure scenarios

These examples show how the concept can affect design and operations. They are illustrative scenarios, not customer claims.

Scenario 01 Analytics product database boundary cleanup Scenario, objectives, solution, measured impact, and takeaway.
Scenario

MetricForge Software had five product teams writing into one PostgreSQL database on a flexible server. Schema migrations collided, and one prototype table consumed most of the storage.

Goals
  • Separate product-owned data into named databases with clear owners.
  • Reduce migration collisions between unrelated engineering teams.
  • Create database inventory evidence for cost and cleanup reviews.
  • Avoid unnecessary server duplication for workloads that could still share compute.
Approach using PostgreSQL database

Using PostgreSQL database boundaries, architects kept related reporting services on one flexible server but created named databases for the core API, customer analytics, internal experiments, and data science staging. Azure CLI exported database inventory before and after the change. Each database received a named owner, migration pipeline, and runtime role. The default postgres database was removed from application connection strings. Monitoring dashboards grouped slow queries and storage growth by database, which let teams identify when a workload was outgrowing the shared server model.

Potential outcomes
  • Migration conflicts dropped from weekly incidents to one minor conflict in three months.
  • Prototype storage was reduced by 420 GB after ownership became visible.
  • The team delayed a separate server purchase while preserving clear workload boundaries.
  • Release approvals became faster because database targets were explicit in pipelines.
What to learn

A PostgreSQL database boundary is useful only when ownership, migrations, roles, and monitoring are as explicit as the name.

Scenario 02 Game telemetry migration target Scenario, objectives, solution, measured impact, and takeaway.
Scenario

BlueAnvil Interactive moved player telemetry from self-hosted PostgreSQL to Azure Database for PostgreSQL. The first rehearsal failed because imports landed in the default database with the wrong collation.

Goals
  • Create a dedicated telemetry database before production import.
  • Match charset and collation requirements from the existing workload.
  • Keep migration identity separate from runtime game-service identity.
  • Validate restore and rollback steps before launch weekend.
Approach using PostgreSQL database

Using PostgreSQL database lifecycle controls, the database team created a named telemetry database with reviewed charset and collation through Azure CLI. Migration scripts connected to that explicit database, installed required extensions, and applied schema versions before bulk load. Runtime services received least-privilege roles after import validation, while the migration identity retained temporary elevated rights. The team rehearsed a restore to a new flexible server, then extracted and compared telemetry row counts, indexes, and query samples. Connection strings in deployment slots were blocked unless the database name matched the approved value. The team also captured database ownership in the release checklist so later imports could not bypass the target database.

Potential outcomes
  • Production import completed 28 percent faster than the first rehearsal.
  • No telemetry tables landed in the default postgres database.
  • Rollback validation finished in 52 minutes against the restored server.
  • Runtime credentials were limited to read and insert permissions after cutover.
What to learn

Creating the right database first prevents migration tools from turning defaults into permanent architecture.

Scenario 03 Research institute shared-server review Scenario, objectives, solution, measured impact, and takeaway.
Scenario

HelioStat Research hosted climate-model datasets on one flexible server. Nobody knew which databases were active, and backup reviews treated all data as equally critical.

Goals
  • Inventory databases and assign owners before renewing cloud budget.
  • Identify abandoned datasets that still consumed storage and backup scope.
  • Document different recovery expectations for active and archived studies.
  • Decide which databases needed separate servers for isolation.
Approach using PostgreSQL database

Using PostgreSQL database inventory, platform engineers used Azure CLI to list databases and correlate names with connection logs, query activity, and storage growth. Owners tagged active studies, archived datasets, and deletion candidates. Application teams updated connection strings to avoid the default database, while researchers received guidance for new database requests. The most active simulation database moved to its own flexible server because it needed a different maintenance window and higher performance tier. Lower-priority archived databases stayed on the shared server with documented restore expectations. Finance reviewers used the same inventory to connect storage growth with grant funding and active research programs.

Potential outcomes
  • Seven unused databases were removed after retention approval, reclaiming 1.2 TB of storage.
  • Monthly PostgreSQL spend fell by 18 percent without reducing active research capacity.
  • Restore objectives were documented for every remaining database.
  • The high-volume simulation workload stopped affecting smaller research databases.
What to learn

Database inventory turns shared PostgreSQL servers from mystery boxes into governed workload platforms.

Azure CLI

As an Azure engineer with ten years of production database work, I use Azure CLI for PostgreSQL database inventory because it gives me a fast, subscription-aware view of what exists on a managed server. The portal is fine for one server, but CLI helps compare environments, export database lists, prove a migration target exists, and avoid typing database names by memory. It also supports repeatable create and delete workflows with change evidence. I still use SQL for grants, schemas, and object-level work, but Azure CLI anchors the database to the right server, resource group, subscription, and lifecycle operation. That keeps review grounded in resource facts before SQL work begins.

Useful for

  • List databases on a flexible server before planning migrations, cleanup, or ownership reviews.
  • Create a named target database with reviewed charset and collation before loading application data.
  • Show database metadata to confirm a pipeline is pointing at the expected server and database.
  • Delete an approved unused database after backup, owner, and retention checks are complete.
  • Compare database inventory across dev, test, and production subscriptions for drift detection.

Before you run a command

  • Confirm tenant, subscription, resource group, server name, target database, and whether the action is read-only or destructive.
  • Check permissions because database create and delete operations require rights on the flexible server resource.
  • Verify the intended charset, collation, owner plan, and migration pipeline before creating a production database.
  • For deletes, confirm backups, retention requirements, legal holds, and application connection strings before using --yes.
  • Use JSON or table output consistently so database inventories can be compared and archived.

What the output tells you

  • Database names show what catalogs exist on the server and help catch missing or unexpected workload databases.
  • Charset and collation fields tell you whether string storage and sorting match application and migration requirements.
  • Resource IDs tie the database operation back to the exact subscription, resource group, and flexible server.
  • Create or delete responses confirm whether the Azure control plane accepted the database lifecycle operation.
  • Empty or unexpected list output usually points to the wrong subscription, server name, or resource group.

Mapped commands

PostgreSQL database CLI Commands

direct
az postgres flexible-server db list --server-name <server-name> --resource-group <resource-group> --output table
az postgres flexible-server dbdiscoverDatabases
az postgres flexible-server db show --server-name <server-name> --resource-group <resource-group> --database-name <database-name>
az postgres flexible-server dbdiscoverDatabases
az postgres flexible-server db create --server-name <server-name> --resource-group <resource-group> --database-name <database-name>
az postgres flexible-server dbprovisionDatabases
az postgres flexible-server db create --server-name <server-name> --resource-group <resource-group> --database-name <database-name> --charset UTF8 --collation <collation>
az postgres flexible-server dbprovisionDatabases
az postgres flexible-server db delete --server-name <server-name> --resource-group <resource-group> --database-name <database-name> --yes
az postgres flexible-server dbremoveDatabases

Architecture context

As an Azure architect, I decide database boundaries before the first schema migration runs. If two applications need different maintenance windows, recovery objectives, access models, or performance envelopes, separate databases may still not be enough; they may need separate flexible servers. If they share the same operational owner and scale pattern, multiple databases on one server can reduce management overhead. The architecture decision balances isolation, cost, connection limits, extension requirements, and restore strategy. I also make the database name explicit in connection strings, pipeline variables, and migration tooling. That discipline prevents teams from treating the default postgres database as an application landing zone.

Security
Security impact is direct because database-level roles, grants, schemas, and extensions determine what a connected identity can read or change after it reaches the server. Azure firewall rules or private access only decide whether a client can attempt a connection; they do not replace PostgreSQL permissions. Operators should avoid using the server administrator for routine application access, create least-privilege roles per database, and keep migration identities separate from runtime identities. Sensitive databases may need stricter auditing, extension review, and schema ownership controls. Cross-database assumptions are risky because PostgreSQL permissions, not Azure RBAC alone, govern data access once the session is established.
Cost
A PostgreSQL database has no independent Azure SKU in flexible server, but it drives shared server cost through storage, I/O, compute, connections, and operational effort. Several small databases on one server can be cost-effective for development or related workloads. The same design becomes expensive when one database forces the whole server to scale up, extend retention, enable high availability, or keep more logs. Unused databases keep consuming storage, backup, monitoring, and security review time. FinOps reviews should connect database ownership to server spend, especially when one team’s database requires a larger tier that every other database on the server inherits.
Reliability
Reliability impact is direct at the workload level and indirect at the Azure resource level. A database can be damaged by a failed migration, bad DDL, extension issue, or accidental drop even when the flexible server remains healthy. Server backups help with recovery, but restoring one database from a managed backup often means restoring to a new server and extracting what is needed. Shared servers also create blast-radius concerns: one noisy database can consume CPU, connections, locks, or storage used by others. Reliable designs include migration rollback plans, schema versioning, backup validation, and monitoring that separates database-level symptoms from server-wide resource pressure.
Performance
Performance impact is direct because a database contains the tables, indexes, queries, extensions, and transactions that consume server resources. Azure flexible server scales compute and storage at the server level, so database-level tuning must happen before blindly increasing SKU size. Bad indexes, bloated tables, lock contention, or chatty migrations in one database can affect other databases sharing the same server. Operators should monitor active connections, long-running queries, dead tuples, table growth, and slow query patterns by database where possible. Good database design improves query latency and reduces shared resource pressure; poor database boundaries hide bottlenecks until users complain. Baselines should include per-database growth and query evidence before scale decisions.
Operations
Operators manage PostgreSQL databases through a mix of Azure CLI, PostgreSQL SQL, migration tools, and monitoring. Common tasks include listing databases, creating a database with the right charset and collation, checking owners, applying schema migrations, validating extension availability, and removing unused databases after retention approval. Azure CLI is useful for inventory and resource-scoped actions, while SQL handles object-level permissions and schema work. Documentation should record database purpose, owner, connection setting, migration pipeline, and restore path. In real environments, operators also compare database lists across staging and production to catch drift before releases. They should also track abandoned databases so storage and backup scope do not quietly grow.

Common mistakes

  • Using the default postgres database for application tables because it was available during a quick prototype.
  • Deleting a database after checking only Azure RBAC, without confirming PostgreSQL owners, backups, and dependent apps.
  • Assuming separate databases on one server have independent compute, backup, maintenance, or failover behavior.
  • Running migrations against the wrong database because the connection string database name was copied from staging.
  • Creating databases with unreviewed collation or charset settings that later complicate imports and comparisons.