Egyszerűen lekérdezhető, hogy éppen mi fut és mióta a PostgreSQL adatbázis szerveren a következő módon:
SELECT datname as db, pid, state, age(clock_timestamp(), query_start) AS age, query
FROM pg_stat_activity
WHERE state <> 'idle'
AND query NOT LIKE '% FROM pg_stat_activity %'
ORDER BY age;
SELECT
relname,
seq_scan - idx_scan AS too_much_seq,
CASE
WHEN seq_scan - coalesce(idx_scan, 0) > 0 THEN 'Missing Index ?'
ELSE 'OK'
END,
pg_relation_size(relname::regclass) AS rel_size,
seq_scan, idx_scan
FROM pg_stat_all_tables
WHERE schemaname = 'public' AND pg_relation_size(relname::regclass) > 80000
ORDER BY too_much_seq DESC;