February 2020
Intermediate to advanced
734 pages
38h 13m
English
The full escalation path starts very subtly to avoid major disruptive action. Perform these steps carefully, assuming eth0 is the network interface that PostgreSQL is using:
SELECT pid, client_port, state,
now() - query_start AS duration, query
FROM pg_stat_activity
WHERE now() - query_start > INTERVAL '2 seconds'
AND state != 'idle'
ORDER BY duration DESC;
SELECT procpid AS pid, client_port,
now() - query_start AS duration, current_query
FROM pg_stat_activity
WHERE now() - query_start > INTERVAL '2 seconds'
AND current_query != '<IDLE>'
ORDER BY duration DESC;
Read now
Unlock full access