Created
June 7, 2022 12:21
-
-
Save khaliqgant/1f137278d3b5b8fbe22dcb952d186288 to your computer and use it in GitHub Desktop.
[Postgres Query Duration] Find long running postgres tasks #postgres #database
This file contains hidden or 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 = 'active'; | |
SELECT max(now() - xact_start) FROM pg_stat_activity | |
WHERE state IN ('idle in transaction', 'active'); | |
--- https://dba.stackexchange.com/questions/44084/troubleshooting-high-cpu-usage-from-postgres-and-postmaster-services |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment