From 4088f481da3fc189e2b1018cd7c55a4cd365efeb Mon Sep 17 00:00:00 2001 From: jsmith Date: Mon, 2 May 2022 23:49:15 +0000 Subject: [PATCH] Add 'PostgreSQL/long_running.sql' --- PostgreSQL/long_running.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 PostgreSQL/long_running.sql diff --git a/PostgreSQL/long_running.sql b/PostgreSQL/long_running.sql new file mode 100644 index 0000000..2ed7afb --- /dev/null +++ b/PostgreSQL/long_running.sql @@ -0,0 +1,7 @@ +SELECT + pid, + now() - pg_stat_activity.query_start AS duration, + query, + state +FROM pg_stat_activity +WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'; \ No newline at end of file