--- title: Azure Database for PostgreSQL Flexible Server - PgBouncer metrics (Preview) description: Metrics to monitor PgBouncer ms.service: postgresql ms.subservice: flexible-server ms.topic: conceptual ms.author: varun.dhawan ms.date: 11/01/2022 --- # Azure Postgres Flexible Server - PgBouncer metrics (Preview) [Zn Sem] ## PgBouncer monitoring Postgres is a powerful and popular open-source relational database management system (RDBMS). However, as the number of connections to a Postgres database grows, managing and monitoring those connections can become a challenge. That's where connection pooling comes in. PgBouncer probably the most popular connection pooler in postgrtes. It is a lightweight connection pooler that helps to improve the performance and scalability of your Postgres databases by managing and reusing database connections. By pooling connections, PgBouncer reduces the number of connections that need to be opened and closed, reducing the load on your Postgres server and improving overall performance. Azure Database for PostgreSQL – Flexible Server offers PgBouncer as a [built-in option](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-pgbouncer#enabling-and-configuring-pgbouncer), wherein customers can easily enable PgBouncer from Azure Postgres server parameters and update the app connection string to talk to PgBouncer on port 6432, rather than directly to the database server. When using PgBouncer, it's important to monitor the performance of PgBouncer to ensure that it's functioning as expected and to identify any potential issues. Here are some key metrics to monitor when using PgBouncer with Azure Postgres Flexible Server: ## List of PgBouncer metrics |Metrics ID |Display Name|Description |Dimension |Show command (optional)| |-------------------------------------|------------|-------------------------------------------------------------------------------------|------------|-----------------------| |pgbouncer.pools.cl_active |cl_active |Connections from clients which are associated with a PostgreSQL connection |DatabaseName|SHOW POOLS | |pgbouncer.pools.cl_waiting |cl_waiting |Connections from clients that are waiting for a PostgreSQL connection to service them|DatabaseName|SHOW POOLS | |pgbouncer.pools.sv_active |sv_active |Connections to PostgreSQL that are in use by a client connection |DatabaseName|SHOW POOLS | |pgbouncer.pools.sv_idle |sv_idle |Connections to PostgreSQL that are idle, ready to service a new client connection |DatabaseName|SHOW POOLS | |pgbouncer.database.active_connections|db_active |Current number of connections for this database |DatabaseName|SHOW DATABASES | |pgbouncer.pools.pools_per_database |pools_by_db |Total number of pools per database |DatabaseName|CUSTOM METRICS | ## Enabling PgBouncer metrics * Most of these new metrics are **disabled** by default * To enable these metrics, please turn ON the server parameter `pgbouncer.diagnostics`. * This parameter is dynamic, and will not require instance restart. ## References * PgBouncer Admin Console - https://www.pgbouncer.org/usage.html ## Team * Engineering - michaellu@microsoft.com, Andrey.Chudnovskiy@microsoft.com * Product - Varun.Dhawan@microsoft.com, gennadyk@microsoft.com