Skip to content

Commit 20db76c

Browse files
author
Roman Nikolaev
committed
Exclude replication sessions from activity statistics
1 parent cbaec97 commit 20db76c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mamonsu/plugins/pgsql/oldest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Oldest(Plugin):
1919
OldestQuerySql = """
2020
select
2121
extract(epoch from max(now() - xact_start))
22-
from pg_catalog.pg_stat_activity;
22+
from pg_catalog.pg_stat_activity where pid not in (select pid from pg_stat_replication);
2323
"""
2424

2525
OldestQuerySql_bootstrap = """

mamonsu/tools/bootstrap/sql.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
SELECT
7171
extract(epoch from max(now() - xact_start))
7272
FROM pg_catalog.pg_stat_activity
73+
WHERE pid not in (select pid from pg_stat_replication)
7374
$$ LANGUAGE SQL SECURITY DEFINER;
7475
7576
CREATE OR REPLACE FUNCTION public.mamonsu_count_{3}_files()

0 commit comments

Comments
 (0)