Skip to content

pg_stat_conn

Cumulative connection, disconnection, and authentication-failure counts by database and role.

pg_stat_conn · Cumulative connection, disconnection, and authentication-failure counts by database and role.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101930pg_stat_connpg_stat_conn1.0STATPostgreSQLC

PostgreSQL · 15, 16, 17, 18

Usage

Sources:

pg_stat_conn Cumulative connection, disconnection, and authentication-failure counts by database and role.

Enablement

Merge pg_stat_conn into the existing preload list, restart PostgreSQL, and then create pg_stat_conn in each database that needs its SQL objects:

shared_preload_libraries = 'pg_stat_conn'
CREATE EXTENSION pg_stat_conn;

Core Workflow

The following example is taken from the reviewed upstream documentation. Adapt object names, paths, credentials, and workload values before use.

psql -c "SELECT pg_stat_conn_reset('postgres', 'postgres');"
psql -c "SELECT pg_stat_conn_reset();"

Main Objects

The reviewed install surface includes these prominent objects:

ObjectKindOperational role
pg_stat_conn_resetFUNCTIONCallable function from the reviewed install surface.

Operations and Boundaries

  • The verified PostgreSQL-major evidence covers 15, 16, 17, 18; do not infer unlisted majors.
  • Preloading pg_stat_conn changes cluster startup state; stage configuration and restart changes separately from CREATE EXTENSION.

Table reader