You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT pid as process_id,
usename as username,
datname as database_name,
client_addr as client_address,
application_name,
backend_start,
state,
state_change
FROM pg_stat_activity;
Get number of used connections and configuration for superuser and normal connections.
SELECT*FROM
(SELECTcount(*) used_connections FROM pg_stat_activity) q1,
(SELECT setting::int connections_reserved_for_superusers FROM pg_settings WHERE name=$$superuser_reserved_connections$$) q2,
(SELECT setting::int maximum_configured_connections FROM pg_settings WHERE name=$$max_connections$$) q3;
Aggregation of all postgres sessions per their status (how many are idle, how many doing something)
SELECT state, count(*) FROM pg_stat_activity WHERE pid <> pg_backend_pid() GROUP BY1ORDER BY1;