Skip to content

Instantly share code, notes, and snippets.

@isocroft
Forked from romuald/processlist.sql
Created July 24, 2025 22:30
Show Gist options
  • Save isocroft/adf3263c2c3ff5d2119712ea6485f0c1 to your computer and use it in GitHub Desktop.
Save isocroft/adf3263c2c3ff5d2119712ea6485f0c1 to your computer and use it in GitHub Desktop.
Show PostgreSQL current (running) process list;
SELECT user, pid, client_addr, waiting, query, query_start, NOW() - query_start AS elapsed
FROM pg_stat_activity
WHERE query != '<IDLE>'
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1
ORDER BY elapsed DESC;
@isocroft
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment