mirror of
https://github.com/RealOrangeOne/notes.git
synced 2024-11-17 06:09:04 +00:00
586 B
586 B
title | tags | link | |
---|---|---|---|
Monitor running queries |
|
https://techmango.org/2017/11/04/monitor-running-queries-postgresql/ |
View a list of running queries:
SELECT
datname,
pid,
usename,
client_addr,
client_port,
xact_start,
backend_start,
query_start,
state,
query
FROM pg_stat_activity
ORDER BY query_start ASC
View list of non-idle connections:
SELECT
datname,
pid,
usename,
client_addr,
client_port,
xact_start,
backend_start,
query_start
FROM pg_stat_activity
WHERE
state != 'idle'
ORDER BY query_start ASC