PostgreSQLSessions
Active queries
Every non-idle backend with what it's waiting on and how long it's been running.
Not yet verified. How scripts are tested
1SELECT pid, usename, datname, client_addr, state,2 wait_event_type, wait_event,3 now() - query_start AS running_for,4 left(query, 200) AS query5FROM pg_stat_activity6WHERE state <> 'idle'7 AND pid <> pg_backend_pid()8ORDER BY query_start;Paste it into your query tool.
More PostgreSQL scripts: Sessions
- Long-running and idle-in-transaction sessionsTransactions open longer than five minutes. Idle-in-transaction sessions hold locks and stop vacuum from cleaning up.
- Cancel a query or terminate a sessionTry cancel first: it stops the current statement and leaves the connection open. Terminate ends the backend and rolls back its transaction.