PostgreSQLSessions
Cancel a query or terminate a session
Try cancel first: it stops the current statement and leaves the connection open. Terminate ends the backend and rolls back its transaction.
Not yet verified. How scripts are tested
1-- Replace 12345 with the pid2SELECT pg_cancel_backend(12345); -- stop the running statement only3SELECT pg_terminate_backend(12345); -- end the whole sessionPaste it into your query tool.
More PostgreSQL scripts: Sessions
- Active queriesEvery non-idle backend with what it's waiting on and how long it's been running.
- Long-running and idle-in-transaction sessionsTransactions open longer than five minutes. Idle-in-transaction sessions hold locks and stop vacuum from cleaning up.