diff --git a/expected/pg_stat_monitor.out b/expected/pg_stat_monitor.out index 5318c3550c7f..04e399878c6c 100644 --- a/expected/pg_stat_monitor.out +++ b/expected/pg_stat_monitor.out @@ -1,11 +1,11 @@ -CREATE EXTENSION pg_stat_statements; +CREATE EXTENSION pg_stat_monitor; -- -- simple and compound statements -- -SET pg_stat_statements.track_utility = FALSE; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SET pg_stat_monitor.track_utility = FALSE; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -95,7 +95,7 @@ EXECUTE pgss_test(1); (1 row) DEALLOCATE pgss_test; -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; query | calls | rows ---------------------------------------------------+-------+------ PREPARE pgss_test (int) AS SELECT $1, $2 LIMIT $3 | 1 | 1 @@ -108,7 +108,7 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; SELECT $1 AS "int" | 2 | 2 SELECT $1 AS i UNION SELECT $2 ORDER BY i | 1 | 2 SELECT $1 || $2 | 1 | 1 - SELECT pg_stat_statements_reset() | 1 | 1 + SELECT pg_stat_monitor_reset() | 1 | 1 WITH t(f) AS ( +| 1 | 2 VALUES ($1), ($2) +| | ) +| | @@ -119,9 +119,9 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; -- -- CRUD: INSERT SELECT UPDATE DELETE on test table -- -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -195,7 +195,7 @@ SELECT * FROM test WHERE a IN (1, 2, 3, 4, 5); 3 | c (8 rows) -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; query | calls | rows -------------------------------------------------------------+-------+------ DELETE FROM test WHERE a > $1 | 1 | 1 @@ -204,18 +204,18 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; SELECT * FROM test ORDER BY a | 1 | 12 SELECT * FROM test WHERE a > $1 ORDER BY a | 2 | 4 SELECT * FROM test WHERE a IN ($1, $2, $3, $4, $5) | 1 | 8 - SELECT pg_stat_statements_reset() | 1 | 1 + SELECT pg_stat_monitor_reset() | 1 | 1 UPDATE test SET b = $1 WHERE a = $2 | 6 | 6 UPDATE test SET b = $1 WHERE a > $2 | 1 | 3 (9 rows) -- --- pg_stat_statements.track = none +-- pg_stat_monitor.track = none -- -SET pg_stat_statements.track = 'none'; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SET pg_stat_monitor.track = 'none'; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -231,18 +231,18 @@ SELECT 1 + 1 AS "two"; 2 (1 row) -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; query | calls | rows -------+-------+------ (0 rows) -- --- pg_stat_statements.track = top +-- pg_stat_monitor.track = top -- -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SET pg_stat_monitor.track = 'top'; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -287,22 +287,22 @@ SELECT PLUS_ONE(10); 11 (1 row) -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; - query | calls | rows ------------------------------------+-------+------ - SELECT $1::TEXT | 1 | 1 - SELECT PLUS_ONE($1) | 2 | 2 - SELECT PLUS_TWO($1) | 2 | 2 - SELECT pg_stat_statements_reset() | 1 | 1 +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; + query | calls | rows +--------------------------------+-------+------ + SELECT $1::TEXT | 1 | 1 + SELECT PLUS_ONE($1) | 2 | 2 + SELECT PLUS_TWO($1) | 2 | 2 + SELECT pg_stat_monitor_reset() | 1 | 1 (4 rows) -- --- pg_stat_statements.track = all +-- pg_stat_monitor.track = all -- -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SET pg_stat_monitor.track = 'all'; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -344,23 +344,23 @@ SELECT PLUS_ONE(1); 2 (1 row) -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; query | calls | rows -----------------------------------+-------+------ SELECT (i + $2 + $3)::INTEGER | 2 | 2 SELECT (i + $2)::INTEGER LIMIT $3 | 2 | 2 SELECT PLUS_ONE($1) | 2 | 2 SELECT PLUS_TWO($1) | 2 | 2 - SELECT pg_stat_statements_reset() | 1 | 1 + SELECT pg_stat_monitor_reset() | 1 | 1 (5 rows) -- -- utility commands -- -SET pg_stat_statements.track_utility = TRUE; -SELECT pg_stat_statements_reset(); - pg_stat_statements_reset --------------------------- +SET pg_stat_monitor.track_utility = TRUE; +SELECT pg_stat_monitor_reset(); + pg_stat_monitor_reset +----------------------- (1 row) @@ -382,7 +382,7 @@ NOTICE: table "test" does not exist, skipping NOTICE: table "test" does not exist, skipping NOTICE: function plus_one(pg_catalog.int4) does not exist, skipping DROP FUNCTION PLUS_TWO(INTEGER); -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; query | calls | rows -------------------------------------------+-------+------ CREATE INDEX test_b ON test(b) | 1 | 0 @@ -392,7 +392,7 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; DROP TABLE IF EXISTS test | 3 | 0 DROP TABLE test | 1 | 0 SELECT $1 | 1 | 1 - SELECT pg_stat_statements_reset() | 1 | 1 + SELECT pg_stat_monitor_reset() | 1 | 1 (8 rows) -DROP EXTENSION pg_stat_statements; +DROP EXTENSION pg_stat_monitor; diff --git a/sql/pg_stat_monitor.sql b/sql/pg_stat_monitor.sql index a8361fd1bff8..a46e25bb25f8 100644 --- a/sql/pg_stat_monitor.sql +++ b/sql/pg_stat_monitor.sql @@ -1,10 +1,10 @@ -CREATE EXTENSION pg_stat_statements; +CREATE EXTENSION pg_stat_monitor; -- -- simple and compound statements -- -SET pg_stat_statements.track_utility = FALSE; -SELECT pg_stat_statements_reset(); +SET pg_stat_monitor.track_utility = FALSE; +SELECT pg_stat_monitor_reset(); SELECT 1 AS "int"; @@ -51,12 +51,12 @@ PREPARE pgss_test (int) AS SELECT $1, 'test' LIMIT 1; EXECUTE pgss_test(1); DEALLOCATE pgss_test; -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -- -- CRUD: INSERT SELECT UPDATE DELETE on test table -- -SELECT pg_stat_statements_reset(); +SELECT pg_stat_monitor_reset(); -- utility "create table" should not be shown CREATE TEMP TABLE test (a int, b char(20)); @@ -99,24 +99,24 @@ SELECT * FROM test ORDER BY a; -- SELECT with IN clause SELECT * FROM test WHERE a IN (1, 2, 3, 4, 5); -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -- --- pg_stat_statements.track = none +-- pg_stat_monitor.track = none -- -SET pg_stat_statements.track = 'none'; -SELECT pg_stat_statements_reset(); +SET pg_stat_monitor.track = 'none'; +SELECT pg_stat_monitor_reset(); SELECT 1 AS "one"; SELECT 1 + 1 AS "two"; -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -- --- pg_stat_statements.track = top +-- pg_stat_monitor.track = top -- -SET pg_stat_statements.track = 'top'; -SELECT pg_stat_statements_reset(); +SET pg_stat_monitor.track = 'top'; +SELECT pg_stat_monitor_reset(); DO LANGUAGE plpgsql $$ BEGIN @@ -144,13 +144,13 @@ $$ SELECT (i + 1.0)::INTEGER LIMIT 1 $$ LANGUAGE SQL; SELECT PLUS_ONE(8); SELECT PLUS_ONE(10); -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -- --- pg_stat_statements.track = all +-- pg_stat_monitor.track = all -- -SET pg_stat_statements.track = 'all'; -SELECT pg_stat_statements_reset(); +SET pg_stat_monitor.track = 'all'; +SELECT pg_stat_monitor_reset(); -- we drop and recreate the functions to avoid any caching funnies DROP FUNCTION PLUS_ONE(INTEGER); @@ -175,13 +175,13 @@ $$ SELECT (i + 1.0)::INTEGER LIMIT 1 $$ LANGUAGE SQL; SELECT PLUS_ONE(3); SELECT PLUS_ONE(1); -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -- -- utility commands -- -SET pg_stat_statements.track_utility = TRUE; -SELECT pg_stat_statements_reset(); +SET pg_stat_monitor.track_utility = TRUE; +SELECT pg_stat_monitor_reset(); SELECT 1; CREATE INDEX test_b ON test(b); @@ -193,6 +193,6 @@ DROP TABLE IF EXISTS test \; DROP FUNCTION IF EXISTS PLUS_ONE(INTEGER); DROP FUNCTION PLUS_TWO(INTEGER); -SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C"; +SELECT query, calls, rows FROM pg_stat_monitor ORDER BY query COLLATE "C"; -DROP EXTENSION pg_stat_statements; +DROP EXTENSION pg_stat_monitor;