mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 05:56:21 +00:00
This bug uncovered serious issues with how the data was being stored by PSGM. So it require a complete redesign. pg_stat_monitor now stores the data locally within the backend process's local memory. The data is only stored when the query completes. This reduces the number of lock acquisitions that were previously needed during various stages of the execution. Also, this avoids data loss in case the current bucket changes during execution. Also, the unavailability of jumble state during later stages of executions was causing pg_stat_monitor to save non-normalized query. This was a major problem as well. pg_stat_monitor specific memory context is implemented. It is used for saving data locally. The context memory callback helps us clear the locally saved data so that we do not store it multiple times in the shared hash. As part of this major rewrite, pgss reference in function and variable names is changed to pgsm. Memory footprint for the entries is reduced, data types are corrected where needed, and we've removed unused variables, functions and macros. This patch was mutually created by: Co-authored-by: Hamid Akhtar <hamid.akhtar@percona.com> Co-authored-by: Muhammad Usama <muhammad.usama@percona.com>
35 lines
599 B
SQL
35 lines
599 B
SQL
CREATE EXTENSION pg_stat_monitor;
|
|
|
|
CREATE DATABASE db1;
|
|
CREATE DATABASE db2;
|
|
|
|
\c db1
|
|
CREATE TABLE t1 (a int);
|
|
CREATE TABLE t2 (b int);
|
|
|
|
\c db2
|
|
CREATE TABLE t3 (c int);
|
|
CREATE TABLE t4 (d int);
|
|
|
|
\c contrib_regression
|
|
SELECT pg_stat_monitor_reset();
|
|
\c db1
|
|
SELECT * FROM t1,t2 WHERE t1.a = t2.b;
|
|
|
|
\c db2
|
|
SELECT * FROM t3,t4 WHERE t3.c = t4.d;
|
|
|
|
\c contrib_regression
|
|
DROP DATABASE db2;
|
|
|
|
SELECT datname, query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
|
SELECT pg_stat_monitor_reset();
|
|
|
|
\c db1
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
|
|
\c contrib_regression
|
|
DROP DATABASE db1;
|
|
DROP EXTENSION pg_stat_monitor;
|