Issue - (#21): Show objects(tables) involved in the query.

PG-96
This commit is contained in:
Ibrar Ahmed
2020-11-24 20:10:49 +00:00
parent 9efa05de97
commit 057150c99b
5 changed files with 75 additions and 163 deletions

View File

@@ -22,6 +22,7 @@ CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT queryid text,
OUT query text,
OUT relations text,
OUT cmd_type text,
OUT elevel int,
OUT sqlcode int,
@@ -58,8 +59,7 @@ CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT blk_write_time float8,
OUT resp_calls text,
OUT cpu_user_time float8,
OUT cpu_sys_time float8,
OUT tables_names text
OUT cpu_sys_time float8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pg_stat_monitor'
@@ -97,6 +97,7 @@ CREATE VIEW pg_stat_monitor AS SELECT
'0.0.0.0'::inet + client_ip AS client_ip,
queryid,
query,
(string_to_array(relations, ',')) relations,
(string_to_array(cmd_type, ',')) cmd_type,
elevel,
sqlcode,
@@ -128,8 +129,7 @@ CREATE VIEW pg_stat_monitor AS SELECT
blk_write_time,
(string_to_array(resp_calls, ',')) resp_calls,
cpu_user_time,
cpu_sys_time,
(string_to_array(tables_names, ',')) tables_names
cpu_sys_time
FROM pg_stat_monitor(TRUE);
CREATE FUNCTION decode_error_level(elevel int)