pg_stat_activity
CautionPostgres sessions
SELECT pid, state, query FROM pg_stat_activity;
Postgres' processlist. Long 'idle in transaction' sessions are the classic lock holders to terminate.
Examples
SELECT pg_terminate_backend(12345);Kill a problem session
Syntax
SELECT * FROM pg_stat_activity; / SELECT pg_terminate_backend(pid);
Before you run it
Termination aborts their work.
Related commands
- Show running queriesShow running queries
- Kill query / sessionKill a query/session
The same reference, with no signal at all
Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.
Get it free on the App Store