Skip to content

Instantly share code, notes, and snippets.

@andrzejsliwa
Forked from riethmayer/slow_queries.sql
Last active August 29, 2015 14:07
Show Gist options
  • Save andrzejsliwa/ca9dab25cfe5fadd3577 to your computer and use it in GitHub Desktop.
Save andrzejsliwa/ca9dab25cfe5fadd3577 to your computer and use it in GitHub Desktop.
SELECT
pid,
datname,
query,
EXTRACT(EPOCH FROM (NOW() - query_start)) AS duration
FROM pg_stat_activity
WHERE state='active'
ORDER BY query_start ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment