Compare commits

..

No commits in common. "main" and "2.3.0" have entirely different histories.
main ... 2.3.0

30 changed files with 72 additions and 146 deletions

View File

@ -10,12 +10,12 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: src/pg_stat_monitor
- name: Checkout cppcheck sources
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: "danmar/cppcheck"
ref: "2.13.4"
@ -43,13 +43,13 @@ jobs:
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_17_STABLE'
- name: Checkout sources
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'contrib/pg_stat_monitor'
@ -87,7 +87,7 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Check license headers
uses: apache/skywalking-eyes/header@61275cc80d0798a405cb070f7d3a8aaf7cf2c2c1 # v0.8.0

View File

@ -16,7 +16,7 @@ jobs:
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_15_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -22,7 +22,7 @@ jobs:
shell: bash
- name: Check out
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: '${{ inputs.version }}'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_13_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_14_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_15_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_16_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_17_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'postgres/postgres'
ref: 'REL_18_STABLE'
@ -83,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: 'src/pg_stat_monitor'

View File

@ -23,7 +23,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
@ -43,6 +43,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
with:
sarif_file: results.sarif

View File

@ -2,7 +2,7 @@
"name": "pg_stat_monitor",
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"description": "pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL's contrib module pg_stat_statements. PostgreSQL’s pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user would need to calculate the aggregates, which is quite an expensive operation.",
"version": "2.3.1",
"version": "2.3.0",
"maintainer": [
"Artem Gavrilov <artem.gavrilov@percona.com>",
"Diego dos Santos Fronza <diego.fronza@percona.com>"
@ -15,7 +15,7 @@
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"file": "pg_stat_monitor--2.2--2.3.sql",
"docfile": "README.md",
"version": "2.3.1"
"version": "2.3.0"
}
},
"prereqs": {

View File

@ -209,14 +209,17 @@ install_deps() {
then
yum -y install git wget
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
wget https://raw.githubusercontent.com/percona/percona-repositories/release-1.0-28/scripts/percona-release.sh
mv percona-release.sh /usr/bin/percona-release
chmod 777 /usr/bin/percona-release
percona-release enable ${PPG_REPO_NAME} testing
if [ x"$RHEL" = x8 ];
then
clang_version=$(yum list --showduplicates clang-devel | grep "20.1" | grep clang | awk '{print $2}' | head -n 1)
llvm_version=$(yum list --showduplicates llvm-devel | grep "20.1" | grep llvm | awk '{print $2}' | head -n 1)
clang_version=$(yum list --showduplicates clang-devel | grep "17.0" | grep clang | awk '{print $2}' | head -n 1)
llvm_version=$(yum list --showduplicates llvm-devel | grep "17.0" | grep llvm | awk '{print $2}' | head -n 1)
yum install -y clang-devel-${clang_version} clang-${clang_version} llvm-devel-${llvm_version}
dnf module disable -y rust-toolset llvm-toolset
dnf module -y disable llvm-toolset
else
yum install -y clang-devel clang llvm-devel
fi
@ -248,24 +251,30 @@ install_deps() {
else
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install lsb-release gnupg git wget curl
export DEBIAN=$(lsb_release -sc)
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
dpkg -i percona-release_latest.generic_all.deb
rm -f percona-release_latest.generic_all.deb
percona-release enable ${PPG_REPO_NAME} testing
PKGLIST="percona-postgresql-${PG_RELEASE} percona-postgresql-common percona-postgresql-server-dev-all"
# ---- using a community version of postgresql
#wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
#echo "deb http://apt.postgresql.org/pub/repos/apt/ ${PG_RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list
#PKGLIST="postgresql-${PG_RELEASE} postgresql-common postgresql-server-dev-all"
apt-get update
if [[ "x${DEBIAN}" == "xbullseye" ]]; then
DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 14 bullseye
else
wget http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/libllvm7_7.0.1-12_amd64.deb http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-12_amd64.deb
apt install ./libllvm7_7.0.1-12_amd64.deb ./llvm-7_7.0.1-12_amd64.deb ./llvm-7-runtime_7.0.1-12_amd64.deb
if [[ "${OS_NAME}" != "focal" ]]; then
LLVM_EXISTS=$(grep -c "apt.llvm.org" /etc/apt/sources.list)
if [ "${LLVM_EXISTS}" == 0 ]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo "deb http://apt.llvm.org/${OS_NAME}/ llvm-toolchain-${OS_NAME}-7 main" >> /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/${OS_NAME}/ llvm-toolchain-${OS_NAME}-7 main" >> /etc/apt/sources.list
apt-get update
fi
fi
PKGLIST+=" debconf debhelper clang devscripts dh-exec git wget libkrb5-dev libssl-dev"

View File

@ -43,7 +43,7 @@ typedef enum pgsmVersion
PG_MODULE_MAGIC;
#define BUILD_VERSION "2.3.1"
#define BUILD_VERSION "2.3.0"
/* Number of output arguments (columns) for various API versions */
#define PG_STAT_MONITOR_COLS_V1_0 52
@ -82,6 +82,7 @@ void _PG_init(void);
/* Current nesting depth of planner/ExecutorRun/ProcessUtility calls */
static int nesting_level = 0;
volatile bool __pgsm_do_not_capture_error = false;
#if PG_VERSION_NUM < 170000
/* Before planner nesting level was conunted separately */
@ -98,9 +99,9 @@ static int hist_bucket_count_total;
static uint32 pgsm_client_ip = PGSM_INVALID_IP_MASK;
/* The array to store outer layer query id*/
static int64 *nested_queryids;
static char **nested_query_txts;
static List *lentries = NIL;
int64 *nested_queryids;
char **nested_query_txts;
List *lentries = NIL;
static char relations[REL_LST][REL_LEN];
@ -202,7 +203,6 @@ char *unpack_sql_state(int sql_state);
static pgsmEntry *pgsm_create_hash_entry(uint64 bucket_id, int64 queryid, PlanInfo *plan_info);
static void pgsm_add_to_list(pgsmEntry *entry, char *query_text, int query_len);
static void pgsm_delete_entry(uint64 queryid);
static pgsmEntry *pgsm_get_entry_for_query(int64 queryid, PlanInfo *plan_info, const char *query_text, int query_len, bool create, CmdType cmd_type);
static int64 get_pgsm_query_id_hash(const char *norm_query, int len);
@ -210,12 +210,12 @@ static void pgsm_cleanup_callback(void *arg);
static void pgsm_store_error(const char *query, ErrorData *edata);
/*---- Local variables ----*/
static MemoryContextCallback mem_cxt_reset_callback =
MemoryContextCallback mem_cxt_reset_callback =
{
.func = pgsm_cleanup_callback,
.arg = NULL
};
static volatile bool callback_setup = false;
volatile bool callback_setup = false;
static void pgsm_update_entry(pgsmEntry *entry,
const char *query,
@ -342,7 +342,7 @@ _PG_init(void)
ExecutorCheckPerms_hook = HOOK(pgsm_ExecutorCheckPerms);
nested_queryids = (int64 *) malloc(sizeof(int64) * max_stack_depth);
nested_query_txts = (char **) calloc(max_stack_depth, sizeof(char *));
nested_query_txts = (char **) malloc(sizeof(char *) * max_stack_depth);
system_init = true;
}
@ -804,8 +804,6 @@ pgsm_ExecutorEnd(QueryDesc *queryDesc)
else
standard_ExecutorEnd(queryDesc);
pgsm_delete_entry(queryDesc->plannedstmt->queryId);
num_relations = 0;
}
@ -1276,7 +1274,6 @@ pgsm_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
PG_END_TRY();
#endif
}
pgsm_delete_entry(pstmt->queryId);
}
/*
@ -1691,43 +1688,6 @@ pgsm_add_to_list(pgsmEntry *entry, char *query_text, int query_len)
MemoryContextSwitchTo(oldctx);
}
static void
pgsm_delete_entry(uint64 queryid)
{
pgsmEntry *entry = NULL;
ListCell *lc = NULL;
if (lentries == NIL)
return;
entry = (pgsmEntry *) llast(lentries);
if (entry->key.queryid == queryid)
{
pfree(entry->query_text.query_pointer);
entry->query_text.query_pointer = NULL;
lentries = list_delete_last(lentries);
return;
}
/*
* The rest of the code is just paranoia. In theory this list is a stack,
* and we always want to remove the last item. Similarly, in the getter
* method we are always looking for the last item.
*/
foreach(lc, lentries)
{
entry = lfirst(lc);
if (entry->key.queryid == queryid)
{
pfree(entry->query_text.query_pointer);
entry->query_text.query_pointer = NULL;
lentries = list_delete_cell(lentries, lc);
return;
}
}
}
static pgsmEntry *
pgsm_get_entry_for_query(int64 queryid, PlanInfo *plan_info, const char *query_text, int query_len, bool create, CmdType cmd_type)
{

View File

@ -42,19 +42,6 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
SELECT pg_stat_monitor_reset() |
(5 rows)
-- make sure that we handle nested queries correctly
BEGIN;
DO $$
DECLARE
i int;
BEGIN
-- default stack limit is 2000kB, 50000 is much larger than that
FOR i IN 1..50000 LOOP
EXECUTE format('SELECT %s', i);
END LOOP;
END;
$$;
COMMIT;
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------

View File

@ -42,19 +42,6 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
SELECT pg_stat_monitor_reset() |
(5 rows)
-- make sure that we handle nested queries correctly
BEGIN;
DO $$
DECLARE
i int;
BEGIN
-- default stack limit is 2000kB, 50000 is much larger than that
FOR i IN 1..50000 LOOP
EXECUTE format('SELECT %s', i);
END LOOP;
END;
$$;
COMMIT;
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------

View File

@ -2,7 +2,7 @@ CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_version();
pg_stat_monitor_version
-------------------------
2.3.1
2.3.0
(1 row)
DROP EXTENSION pg_stat_monitor;

View File

@ -16,22 +16,5 @@ $$ language plpgsql;
SELECT add2(1,2);
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
-- make sure that we handle nested queries correctly
BEGIN;
DO $$
DECLARE
i int;
BEGIN
-- default stack limit is 2000kB, 50000 is much larger than that
FOR i IN 1..50000 LOOP
EXECUTE format('SELECT %s', i);
END LOOP;
END;
$$;
COMMIT;
SELECT pg_stat_monitor_reset();
DROP EXTENSION pg_stat_monitor;