PG-147: Store top query, instead of parent query.

This commit is contained in:
Ibrar Ahmed
2021-02-17 14:43:00 +00:00
parent 6aa1b2e7b6
commit cabab69b76
2 changed files with 28 additions and 35 deletions

View File

@@ -31,7 +31,7 @@ CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT client_ip int8,
OUT queryid text,
OUT parentid text,
OUT top_queryid text,
OUT query text,
OUT application_name text,
OUT relations text,
@@ -126,9 +126,9 @@ CREATE VIEW pg_stat_monitor AS SELECT
datname,
'0.0.0.0'::inet + client_ip AS client_ip,
queryid,
parentid,
top_queryid,
query,
(SELECT query from pg_stat_monitor(true) s where s.queryid = p.parentid) AS parent_query,
(SELECT query from pg_stat_monitor(true) s where s.queryid = p.top_queryid) AS top_query,
application_name,
string_to_array(relations, ',') AS relations,
cmd_type,