Created
April 4, 2019 11:32
-
-
Save ugursogukpinar/127f86868024d13e13469cb53b868972 to your computer and use it in GitHub Desktop.
PostgreSQL get transaction durations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, now() - xact_start as duration FROM pg_stat_activity WHERE state IN ('idle in transaction', 'active') | |
order by now() - xact_start desc | |
limit 5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment