Connections by application and state#
What it does
Summarizes current connections by database, user, application, client, and state.
Use when
- Connection usage is unexpectedly high or a connection pool is exhausted.
- Identifying which applications account for database sessions.
Inspect
- Applications or users holding many connections.
- Large groups of idle or idle-in-transaction sessions.
Result
Current state at execution time.
Columns#
| Column | Meaning |
|---|---|
application_name |
Client-supplied application name. |
client_address |
Network address of the client; null represents a local Unix socket. |
connections |
Number of sessions in the group. |
database_name |
Database to which the sessions are connected. |
state |
Current backend state reported by PostgreSQL. |
user_name |
Connected PostgreSQL role. |
Parameters#
| Option | Type | Default | Description |
|---|---|---|---|
--limit |
integer, minimum 1, accepts NULL | 20 |
Maximum number of rows to show. Use NULL for no limit. |
Privileges#
Without membership of pg_monitor, other sessions' query text and statistics may be hidden, and pgcue warns that results may be incomplete.
Compatibility#
- PostgreSQL 14+
Related checks#
- Idle transactions
activity.idle_transactions - Long-running transactions
activity.long_transactions