Merge pull request #265 from EngineeredVirus/main

Merging the REL_1_STABLE branch onto the main branch.
pull/267/head
Ibrar Ahmed 2022-06-20 17:22:47 +05:00 committed by GitHub
commit 86978bc4ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 340 additions and 183 deletions

View File

@ -1,4 +1,4 @@
name: code-coverage-test
name: coverage_test
on:
pull_request:
types:

View File

@ -2,7 +2,7 @@ name: Build pg_stat_monitor docs
on:
push:
branches:
- REL1_0_STABLE
- REL_1_STABLE
jobs:
@ -44,7 +44,7 @@ jobs:
# Deploy docs
- name: Deploy docs
run: |
mike deploy REL1_0_STABLE -p
mike set-default REL1_0_STABLE -p
mike retitle REL1_0_STABLE "1.0.x (stable)" -p
mike deploy REL_1_STABLE -p
mike set-default REL_1_STABLE -p
mike retitle REL_1_STABLE "1.0.x (stable)" -p

View File

@ -0,0 +1,33 @@
name: postgresql-11-pmm-integration
on: push
jobs:
build:
name: pg-11-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
# print branch and Repo name
- name: Get branch and Repo Name
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor
- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=11
- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
run: docker exec pgsql_pgsm_11 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
path: ./pmm-ui-tests/tests/output/
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`

View File

@ -0,0 +1,33 @@
name: postgresql-12-pmm-integration
on: push
jobs:
build:
name: pg-12-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
# print branch and Repo name
- name: Get branch and Repo Name
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor
- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=12
- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
run: docker exec pgsql_pgsm_12 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
path: ./pmm-ui-tests/tests/output/
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`

View File

@ -0,0 +1,33 @@
name: postgresql-13-pmm-integration
on: push
jobs:
build:
name: pg-13-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
# print branch and Repo name
- name: Get branch and Repo Name
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor
- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=13
- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
run: docker exec pgsql_pgsm_13 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
path: ./pmm-ui-tests/tests/output/
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`

View File

@ -0,0 +1,33 @@
name: postgresql-14-pmm-integration
on: push
jobs:
build:
name: pg-14-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
# print branch and Repo name
- name: Get branch and Repo Name
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor
- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=14
- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
run: docker exec pgsql_pgsm_14 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
path: ./pmm-ui-tests/tests/output/
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`

3
.gitignore vendored
View File

@ -49,3 +49,6 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf
## IDE
.idea

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. PostgreSQLs 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": "dev",
"version": "1.1.0-dev",
"maintainer": [
"ibrar.ahmed@percona.com"
],
@ -12,7 +12,7 @@
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"file": "pg_stat_monitor--1.0.sql",
"docfile": "README.md",
"version": "dev"
"version": "1.1.0-dev"
}
},
"prereqs": {

View File

@ -1,8 +1,7 @@
![PostgreSQL-11](https://github.com/percona/pg_stat_monitor/workflows/postgresql-11-build/badge.svg) ![PostgreSQL-11-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-11-package/badge.svg) ![PostgreSQL-12](https://github.com/percona/pg_stat_monitor/workflows/postgresql-12-build/badge.svg) ![PostgreSQL-12-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-12-package/badge.svg)
![PostgreSQL-13](https://github.com/percona/pg_stat_monitor/workflows/postgresql-13-build/badge.svg) ![PostgreSQL-13-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-13-package/badge.svg) ![PostgreSQL-14](https://github.com/percona/pg_stat_monitor/workflows/postgresql-14-build/badge.svg)
![PostgreSQL-11](https://github.com/percona/pg_stat_monitor/workflows/postgresql-11-build/badge.svg) ![PostgreSQL-11-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-11-package/badge.svg)
![PostgreSQL-12](https://github.com/percona/pg_stat_monitor/workflows/postgresql-12-build/badge.svg) ![PostgreSQL-12-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-12-package/badge.svg)
![PostgreSQL-13](https://github.com/percona/pg_stat_monitor/workflows/postgresql-13-build/badge.svg) ![PostgreSQL-13-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-13-package/badge.svg)
![PostgreSQL-14](https://github.com/percona/pg_stat_monitor/workflows/postgresql-14-build/badge.svg) ![PostgreSQL-14-Package](https://github.com/percona/pg_stat_monitor/workflows/postgresql-14-package/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/percona/pg_stat_monitor/badge.svg?branch=main)](https://coveralls.io/github/percona/pg_stat_monitor?branch=main)
@ -39,7 +38,9 @@ The `pg_stat_monitor` is a **_Query Performance Monitoring_** tool for PostgreSQ
`pg_stat_monitor` provides improved insights that allow database users to understand query origins, execution, planning statistics and details, query information, and metadata. This significantly improves observability, enabling users to debug and tune query performance. `pg_stat_monitor` is developed on the basis of `pg_stat_statements` as its more advanced replacement.
While `pg_stat_statements` provides ever-increasing metrics, `pg_stat_monitor` aggregates the collected data, saving user efforts for doing it themselves. `pg_stat_monitor` stores statistics in configurable time-based units buckets. This allows focusing on statistics generated for shorter time periods and makes query timing information such as max/min/mean time more accurate.
While `pg_stat_statements` provides ever-increasing metrics, `pg_stat_monitor` aggregates the collected data, saving user efforts for doing it themselves. `pg_stat_monitor` stores statistics in configurable time-based units buckets. This allows focusing on statistics generated for shorter time periods and makes query timing information such as max/min/mean time more accurate.
>**NOTE**: Because of these differences in data processing, memory blocks and WAL (Write Ahead Logs) related statistics data are displayed inconsistently when both `pg_stat_monitor` and `pg_stat_statements` are used together.
To learn about other features, available in `pg_stat_monitor`, see the [Features](#pg_stat_monitor-features) section and the [User Guide](https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md).

3
debian/rules vendored
View File

@ -11,6 +11,9 @@ export USE_PGXS=1
%:
dh $@
override_dh_builddeb:
dh_builddeb -- -Zgzip
override_dh_auto_build:
+pg_buildext clean . build-%v
+pg_buildext build . build-%v

View File

@ -4,6 +4,9 @@ The `pg_stat_monitor` extension is developed on the basis of `pg_stat_statements
Thus, `pg_stat_monitor` inherits the columns available in `pg_stat_statements` plus provides additional ones.
Note that [`pg_stat_monitor` and `pg_stat_statements` process statistics data differently](index.md#how-pg_stat_monitor-works). Because of these differences, memory blocks and WAL (Write Ahead Logs) related statistics data are displayed inconsistently when both extensions are used together.
To see all available columns, run the following command from the `psql` terminal:
```sql

View File

@ -2,6 +2,20 @@
Below is the complete list of release notes for every version of ``pg_stat_monitor``.
## 1.0.1
### Bugs Fixed
[PG-382](https://jira.percona.com/browse/PG-382): Histogram default settings changed to prevent the PostgreSQL server to crash
[PG-417](https://jira.percona.com/browse/PG-417): Addressed security vulnerabilities to prevent an attacker from precreating functions
[DISTPG-427](https://jira.percona.com/browse/DISTPG-427): Fixed the issue with the extensions not working when pg_stat_monitor is enabled by replacing the `return` with `goto exit` for the `pgsm_emit_log_hook` function
## 1.0.0
Bump version from 1.0.0-rc.2 to 1.0.0.
## 1.0.0-rc.2
### Improvements
@ -42,6 +56,33 @@ Below is the complete list of release notes for every version of ``pg_stat_monit
[PG-369](https://jira.percona.com/browse/PG-358): Fixed issue with incorrect `wal_bytes` values for PostgreSQL 11 and 12 that caused Query Analytics failure in PMM by ignoring the `WalUsage` variable value for these versions.
## 1.0.0-rc.1
### Improvements
[PG-165](https://jira.percona.com/browse/PG-165): Recycle expired buckets
[PG-167](https://jira.percona.com/browse/PG-167): Make SQL error codes readable by updating their data types
[PG-193](https://jira.percona.com/browse/PG-193): Create a comment based tags to identify different parameters
[PG-199](https://jira.percona.com/browse/PG-199): Documentation: Add the integration with PMM section in User Guide
[PG-210](https://jira.percona.com/browse/PG-210): Documentation: Update column names per POstgreSQL version to match the upstream ones
### Bugs Fixed
[PG-177](https://jira.percona.com/browse/PG-177): Fixed the error in histogram ranges
[PG-214](https://jira.percona.com/browse/PG-214): Fixed the issue with the display of the error message as part of the query column in `pg_stat_monitor` view
[PG-246](https://jira.percona.com/browse/PG-246): Fixed the issue with significant CPU and memory resource usage when `pg_stat_monitor.pgsm_enable_query_plan` parameter is enabled
[PG-262](https://jira.percona.com/browse/PG-262): Fixed the way the comments are extracted in pg_stat_monitor view
[PG-271](https://jira.percona.com/browse/PG-271): Fixed the issue with enabling the ``pg_stat_monitor.pgsm_overflow_target`` configuration parameter.
[PG-272](https://jira.percona.com/browse/PG-272): Fixed the server crash when calling the `pg_stat_monitor_reset()` function by using the correct `PGSM_MAX_BUCKETS` GUC as the limit to the loop
## REL0_9_0_STABLE
@ -132,6 +173,7 @@ Column datname (string) was added (replacement for dbid).
## REL0_7_0_STABLE
### Improvements
[PG-153](https://jira.percona.com/browse/PG-153): Capture and record the application_name executing the query.

2
guc.c
View File

@ -75,7 +75,7 @@ init_guc(void)
conf[i] = (GucVariable) {
.guc_name = "pg_stat_monitor.pgsm_normalized_query",
.guc_desc = "Selects whether save query in normalized format.",
.guc_default = 1,
.guc_default = 0,
.guc_min = 0,
.guc_max = 0,
.guc_restart = false,

View File

@ -27,7 +27,7 @@
PG_MODULE_MAGIC;
#define BUILD_VERSION "Dev"
#define BUILD_VERSION "1.1.0-dev"
#define PG_STAT_STATEMENTS_COLS 53 /* maximum of above */
#define PGSM_TEXT_FILE "/tmp/pg_stat_monitor_query"
@ -181,7 +181,7 @@ static void pg_stat_monitor_internal(FunctionCallInfo fcinfo,
static void AppendJumble(JumbleState *jstate,
const unsigned char *item, Size size);
static void JumbleQuery(JumbleState *jstate, Query *query);
static void JumbleRangeTable(JumbleState *jstate, List *rtable);
static void JumbleRangeTable(JumbleState *jstate, List *rtable, CmdType cmd_type);
static void JumbleExpr(JumbleState *jstate, Node *node);
static void RecordConstLocation(JumbleState *jstate, int location);
/*
@ -728,7 +728,7 @@ pgss_ExecutorCheckPerms(List *rt, bool abort)
num_relations = 0;
foreach(lr, rt)
foreach(lr, rt)
{
RangeTblEntry *rte = lfirst(lr);
if (rte->rtekind != RTE_RELATION)
@ -1664,11 +1664,15 @@ pg_stat_monitor_reset(PG_FUNCTION_ARGS)
*(uint64 *)pgss_qbuf = 0;
#ifdef BENCHMARK
for (int i = STATS_START; i < STATS_END; ++i) {
pg_hook_stats[i].min_time = 0;
pg_hook_stats[i].max_time = 0;
pg_hook_stats[i].total_time = 0;
pg_hook_stats[i].ncalls = 0;
{
int i;
for (i = STATS_START; i < STATS_END; ++i)
{
pg_hook_stats[i].min_time = 0;
pg_hook_stats[i].max_time = 0;
pg_hook_stats[i].total_time = 0;
pg_hook_stats[i].ncalls = 0;
}
}
#endif
LWLockRelease(pgss->lock);
@ -1934,7 +1938,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
nulls[i++] = true;
/* cmd_type at column number 11 */
if (tmp.info.cmd_type < 0)
if (tmp.info.cmd_type == CMD_NOTHING)
nulls[i++] = true;
else
values[i++] = Int64GetDatumFast(tmp.info.cmd_type);
@ -2229,9 +2233,19 @@ JumbleQuery(JumbleState *jstate, Query *query)
APP_JUMB(query->commandType);
/* resultRelation is usually predictable from commandType */
JumbleExpr(jstate, (Node *) query->cteList);
JumbleRangeTable(jstate, query->rtable);
JumbleExpr(jstate, (Node *) query->jointree);
JumbleExpr(jstate, (Node *) query->targetList);
JumbleRangeTable(jstate, query->rtable, query->commandType);
/*
* Skip jointree and targetlist in case of insert statment
* to avoid queryid duplication problem.
*/
if (query->commandType != CMD_INSERT)
{
JumbleExpr(jstate, (Node *) query->jointree);
JumbleExpr(jstate, (Node *) query->targetList);
}
JumbleExpr(jstate, (Node *) query->onConflict);
JumbleExpr(jstate, (Node *) query->returningList);
JumbleExpr(jstate, (Node *) query->groupClause);
@ -2250,7 +2264,7 @@ JumbleQuery(JumbleState *jstate, Query *query)
* Jumble a range table
*/
static void
JumbleRangeTable(JumbleState *jstate, List *rtable)
JumbleRangeTable(JumbleState *jstate, List *rtable, CmdType cmd_type)
{
ListCell *lc = NULL;
@ -2258,6 +2272,9 @@ JumbleRangeTable(JumbleState *jstate, List *rtable)
{
RangeTblEntry *rte = lfirst_node(RangeTblEntry, lc);
if (rte->rtekind != RTE_RELATION && cmd_type == CMD_INSERT)
continue;
APP_JUMB(rte->rtekind);
switch (rte->rtekind)
{

View File

@ -14,7 +14,7 @@ SELECT 1 AS num;
SELECT query,application_name FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | application_name
-------------------------------------------------------------------------------+-----------------------------
SELECT $1 AS num | pg_regress/application_name
SELECT 1 AS num | pg_regress/application_name
SELECT pg_stat_monitor_reset() | pg_regress/application_name
SELECT query,application_name FROM pg_stat_monitor ORDER BY query COLLATE "C" | pg_regress/application_name
(3 rows)

View File

@ -22,8 +22,8 @@ SELECT 1 AS num;
SELECT query,application_name FROM pg_stat_monitor ORDER BY query, application_name COLLATE "C";
query | application_name
-------------------------------------------------------------------------------------------------+------------------------------------
SELECT $1 AS num | naeem
SELECT $1 AS num | psql
SELECT 1 AS num | naeem
SELECT 1 AS num | psql
SELECT pg_stat_monitor_reset() | pg_regress/application_name_unique
SELECT query,application_name FROM pg_stat_monitor ORDER BY query, application_name COLLATE "C" | psql
Set application_name = 'naeem' | naeem

View File

@ -14,7 +14,7 @@ SELECT 1 AS num;
SELECT query FROM pg_stat_monitor ORDER BY query COLLATE "C";
query
--------------------------------------------------------------
SELECT $1 AS num
SELECT 1 AS num
SELECT pg_stat_monitor_reset()
SELECT query FROM pg_stat_monitor ORDER BY query COLLATE "C"
(3 rows)

View File

@ -30,13 +30,13 @@ SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLA
CREATE TABLE t2 (b INTEGER) | 0 |
DELETE FROM t1 | 4 | DELETE
DROP TABLE t1 | 0 |
INSERT INTO t1 VALUES($1) | 3 | INSERT
INSERT INTO t1 VALUES(1) | 3 | INSERT
SELECT a FROM t1 | 1 | SELECT
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
SELECT pg_stat_monitor_reset() | 1 | SELECT
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C" | 1 | SELECT
TRUNCATE t1 | 0 |
UPDATE t1 SET a = $1 | 2 | UPDATE
UPDATE t1 SET a = 2 | 2 | UPDATE
(11 rows)
SELECT pg_stat_monitor_reset();

View File

@ -23,9 +23,9 @@ WARNING: warning message
SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel;
query | elevel | sqlcode | message
-----------------------------------------------------------------------------------------------+--------+---------+-----------------------------------
ELECET * FROM unknown; | 20 | 42601 | syntax error at or near "ELECET"
SELECT * FROM unknown; | 20 | 42P01 | relation "unknown" does not exist
SELECT 1/0; | 20 | 22012 | division by zero
ELECET * FROM unknown; | 21 | 42601 | syntax error at or near "ELECET"
SELECT * FROM unknown; | 21 | 42P01 | relation "unknown" does not exist
SELECT 1/0; | 21 | 22012 | division by zero
SELECT pg_stat_monitor_reset() | 0 | |
SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel | 0 | |
do $$ +| 0 | |

View File

@ -20,7 +20,7 @@ SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLA
query | elevel | sqlcode | message
-----------------------------------------------------------------------------------------------+--------+---------+---------------------------------------------------------------
Drop Table if exists Company | 0 | |
INSERT INTO Company(ID, Name) VALUES ($1, $2) | 0 | |
INSERT INTO Company(ID, Name) VALUES (1, 'Percona') | 0 | |
INSERT INTO Company(ID, Name) VALUES (1, 'Percona'); | 21 | 23505 | duplicate key value violates unique constraint "company_pkey"
SELECT pg_stat_monitor_reset() | 0 | |
SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel | 0 | |

View File

@ -22,7 +22,7 @@ SELECT * FROM pg_stat_monitor_settings ORDER BY name COLLATE "C";
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_query_shared_buffer | 20 | 20 | Sets the maximum size of shared memory in (MB) used for query tracked by pg_stat_monitor. | 1 | 10000 | | yes

View File

@ -49,9 +49,9 @@ SELECT substr(query, 0,50) as query, calls, resp_calls FROM pg_stat_monitor ORDE
---------------------------------------------------+-------+-----------------------
SELECT pg_sleep(i) | 5 | {0,0,0,0,0,0,3,2,0,0}
SELECT pg_stat_monitor_reset() | 1 | {1,0,0,0,0,0,0,0,0,0}
SELECT substr(query, $1,$2) as query, calls, resp | 1 | {1,0,0,0,0,0,0,0,0,0}
SELECT substr(query, 0,50) as query, calls, resp_ | 1 | {1,0,0,0,0,0,0,0,0,0}
Set pg_stat_monitor.pgsm_track='all' | 1 | {1,0,0,0,0,0,0,0,0,0}
select run_pg_sleep($1) | 1 | {0,0,0,0,0,0,0,0,1,0}
select run_pg_sleep(5) | 1 | {0,0,0,0,0,0,0,0,1,0}
(5 rows)
select * from generate_histogram();

View File

@ -49,9 +49,9 @@ SELECT substr(query, 0,50) as query, calls, resp_calls FROM pg_stat_monitor ORDE
---------------------------------------------------+-------+-----------------------
SELECT pg_sleep(i) | 5 | {0,0,0,0,0,0,3,2,0,0}
SELECT pg_stat_monitor_reset() | 1 | {1,0,0,0,0,0,0,0,0,0}
SELECT substr(query, $1,$2) as query, calls, resp | 1 | {1,0,0,0,0,0,0,0,0,0}
SELECT substr(query, 0,50) as query, calls, resp_ | 1 | {1,0,0,0,0,0,0,0,0,0}
Set pg_stat_monitor.pgsm_track='all' | 1 | {1,0,0,0,0,0,0,0,0,0}
select run_pg_sleep($1) | 1 | {0,0,0,0,0,0,0,0,1,0}
select run_pg_sleep(5) | 1 | {0,0,0,0,0,0,0,0,1,0}
(5 rows)
select * from generate_histogram();

View File

@ -8544,11 +8544,11 @@ SELECT query, rows_retrieved FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | rows_retrieved
------------------------------------------------------------------------------+----------------
SELECT * FROM t1 | 1000
SELECT * FROM t1 LIMIT $1 | 10
SELECT * FROM t1 LIMIT 10 | 10
SELECT * FROM t2 | 5000
SELECT pg_stat_monitor_reset() | 1
SELECT query, rows_retrieved FROM pg_stat_monitor ORDER BY query COLLATE "C" | 0
SELECt * FROM t2 WHERE b % $1 = $2 | 2500
SELECt * FROM t2 WHERE b % 2 = 0 | 2500
(6 rows)
SELECT pg_stat_monitor_reset();

View File

@ -12,11 +12,11 @@ SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */;
(1 row)
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
---------------------------------------------------------------------------+----------------------------------------------------------
SELECT $1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */ | /* { "application", psql_app, "real_ip", 192.168.1.3) */
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
query | comments
--------------------------------------------------------------------------+----------------------------------------------------------
SELECT 1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3) */ | /* { "application", psql_app, "real_ip", 192.168.1.3) */
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(3 rows)
SELECT pg_stat_monitor_reset();

View File

@ -24,9 +24,9 @@ SELECT add2(1,2);
(1 row)
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | top_query
-------------------------------------------------------------------------+--------------------
(select $1 + $2) | SELECT add2($1,$2)
query | top_query
-------------------------------------------------------------------------+------------------
(select $1 + $2) | SELECT add2(1,2)
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS +|
$$ +|
BEGIN +|
@ -38,7 +38,7 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
return add($1,$2); +|
END; +|
$$ language plpgsql |
SELECT add2($1,$2) |
SELECT add2(1,2) |
SELECT pg_stat_monitor_reset() |
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(6 rows)

View File

@ -2,7 +2,7 @@ CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_version();
pg_stat_monitor_version
-------------------------
Dev
1.1.0-dev
(1 row)
DROP EXTENSION pg_stat_monitor;

View File

@ -65,5 +65,8 @@ sed -i 's:PG_CONFIG = pg_config:PG_CONFIG = /usr/pgsql-%{pgrel}/bin/pg_config:'
%changelog
* Thu May 26 2022 Kai Wagner <kai.wagner@percona.com> - 1.0.1-1
- First patch release
* Wed Nov 17 2021 Evgeniy Patlan <evgeniy.patlan@percona.com> - 1.0.0-1
- Initial build

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -31,11 +31,11 @@ select datname, substr(query,0,100) as query, calls from pg_stat_monitor order b
---------+-----------------------------------------------------------------------------------------------------+-------
example | BEGIN | 10000
example | END | 10000
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP | 10000
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (18, 4, 559735, 3884, CURRENT_TIME | 10000
example | SELECT abalance FROM pgbench_accounts WHERE aid = 302191 | 10000
example | UPDATE pgbench_accounts SET abalance = abalance + 850 WHERE aid = 142401 | 10000
example | UPDATE pgbench_branches SET bbalance = bbalance + 3884 WHERE bid = 4 | 10000
example | UPDATE pgbench_tellers SET tbalance = tbalance + 3884 WHERE tid = 18 | 10000
example | alter table pgbench_accounts add primary key (aid) | 1
example | alter table pgbench_branches add primary key (bid) | 1
example | alter table pgbench_tellers add primary key (tid) | 1
@ -47,8 +47,8 @@ select datname, substr(query,0,100) as query, calls from pg_stat_monitor order b
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfacto | 1
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
example | insert into pgbench_branches(bid,bbalance) values($1,$2) | 10
example | insert into pgbench_tellers(tid,bid,tbalance) values ($1,$2,$3) | 100
example | insert into pgbench_branches(bid,bbalance) values(1,0) | 10
example | insert into pgbench_tellers(tid,bid,tbalance) values (1,1,0) | 100
(20 rows)
SELECT * from pg_stat_monitor_settings;
@ -57,7 +57,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -31,7 +31,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -48,9 +48,9 @@ SELECT * from pg_stat_monitor_settings;
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor;
query | calls | total_plan_time | min_plan_time | max_plan_time | mean_plan_time | stddev_plan_time
---------------------------------------------------------------------------------------------------------------------------+-------+-----------------+---------------+---------------+----------------+------------------
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor | 1 | 0.9429 | 0.9429 | 0.9429 | 0.9429 | 0
SELECT * from pg_stat_monitor_settings | 2 | 0.2432 | 0.1214 | 0.1219 | 0.1216 | 0.0002
SELECT pg_stat_monitor_reset() | 1 | 0 | 0 | 0 | 0 | 0
SELECT * from pg_stat_monitor_settings | 2 | 0.182 | 0.0895 | 0.0926 | 0.091 | 0.0015
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor | 1 | 1.4538 | 1.4538 | 1.4538 | 1.4538 | 0
(3 rows)
SELECT pg_stat_monitor_reset();
@ -65,7 +65,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -85,7 +85,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -102,9 +102,15 @@ SELECT * from pg_stat_monitor_settings;
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor;
query | calls | total_plan_time | min_plan_time | max_plan_time | mean_plan_time | stddev_plan_time
---------------------------------------------------------------------------------------------------------------------------+-------+-----------------+---------------+---------------+----------------+------------------
<<<<<<< HEAD
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor | 1 | 0 | 0 | 0 | 0 | 0
SELECT pg_stat_monitor_reset() | 1 | 0 | 0 | 0 | 0 | 0
SELECT * from pg_stat_monitor_settings | 2 | 0 | 0 | 0 | 0 | 0
=======
SELECT * from pg_stat_monitor_settings | 2 | 0 | 0 | 0 | 0 | 0
SELECT pg_stat_monitor_reset() | 1 | 0 | 0 | 0 | 0 | 0
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_time from pg_stat_monitor | 1 | 0 | 0 | 0 | 0 | 0
>>>>>>> origin/REL_1_STABLE
(3 rows)
select substr(query, 0,100) as query, calls, total_plan_time, min_plan_time,max_plan_time,mean_plan_time,stddev_plan_time from pg_stat_monitor order by query;
@ -113,12 +119,12 @@ select substr(query, 0,100) as query, calls, total_plan_time, min_plan_time,max_
SELECT * from pg_stat_monitor_settings | 2 | 0 | 0 | 0 | 0 | 0
SELECT pg_stat_monitor_reset() | 1 | 0 | 0 | 0 | 0 | 0
SELECT query, calls, total_plan_time, min_plan_time, max_plan_time, mean_plan_time, stddev_plan_tim | 1 | 0 | 0 | 0 | 0 | 0
select (max_plan_time = $1) from pg_stat_monitor where calls = $2 | 1 | 0 | 0 | 0 | 0 | 0
select (mean_plan_time = $1) from pg_stat_monitor where calls = $2 | 1 | 0 | 0 | 0 | 0 | 0
select (min_plan_time = $1) from pg_stat_monitor where calls = $2 | 1 | 0 | 0 | 0 | 0 | 0
select (stddev_plan_time = $1) from pg_stat_monitor where calls = $2 | 1 | 0 | 0 | 0 | 0 | 0
select (total_plan_time = $1) from pg_stat_monitor where calls = $2 | 1 | 0 | 0 | 0 | 0 | 0
select substr(query, $1,$2) as query, calls, total_plan_time, min_plan_time,max_plan_time,mean_plan | 1 | 0 | 0 | 0 | 0 | 0
select (max_plan_time = 0) from pg_stat_monitor where calls = 2 | 1 | 0 | 0 | 0 | 0 | 0
select (mean_plan_time = 0) from pg_stat_monitor where calls = 2 | 1 | 0 | 0 | 0 | 0 | 0
select (min_plan_time = 0) from pg_stat_monitor where calls = 2 | 1 | 0 | 0 | 0 | 0 | 0
select (stddev_plan_time = 0) from pg_stat_monitor where calls = 2 | 1 | 0 | 0 | 0 | 0 | 0
select (total_plan_time = 0) from pg_stat_monitor where calls = 2 | 1 | 0 | 0 | 0 | 0 | 0
select substr(query, 0,100) as query, calls, total_plan_time, min_plan_time,max_plan_time,mean_plan | 1 | 0 | 0 | 0 | 0 | 0
(9 rows)
SELECT pg_stat_monitor_reset();

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -32,12 +32,12 @@ SELECT 1 AS num /* First comment */, 'John' as Name /* Second comment*/;
(1 row)
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
------------------------------------------------------------------------+------------------------------------------
SELECT $1 AS num /* First comment */, $2 as Name /* Second comment*/ | /* First comment */, /* Second comment*/
SELECT * from pg_stat_monitor_settings |
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
query | comments
-------------------------------------------------------------------------+------------------------------------------
SELECT * from pg_stat_monitor_settings |
SELECT 1 AS num /* First comment */, 'John' as Name /* Second comment*/ | /* First comment */, /* Second comment*/
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(4 rows)
SELECT pg_stat_monitor_reset();
@ -52,7 +52,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -73,12 +73,12 @@ SELECT 1 AS num /* First comment */, 'John' as Name /* Second comment*/;
(1 row)
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C";
query | comments
------------------------------------------------------------------------+------------------------------------------
SELECT $1 AS num /* First comment */, $2 as Name /* Second comment*/ | /* First comment */, /* Second comment*/
SELECT * from pg_stat_monitor_settings |
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
query | comments
-------------------------------------------------------------------------+------------------------------------------
SELECT * from pg_stat_monitor_settings |
SELECT 1 AS num /* First comment */, 'John' as Name /* Second comment*/ | /* First comment */, /* Second comment*/
SELECT pg_stat_monitor_reset() |
SELECT query, comments FROM pg_stat_monitor ORDER BY query COLLATE "C" |
(4 rows)
Drop extension pg_stat_monitor;

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -44,11 +44,11 @@ select substr(query, 0,50) as query, calls, query_plan from pg_stat_monitor orde
query | calls | query_plan
---------------------------------------------------+-------+-------------------------------------------
CREATE TABLE TBL_0(key text primary key, txt_0 te | 1 |
INSERT INTO TBL_0(key, txt_0, value_0) VALUES($1, | 1 |
INSERT INTO TBL_0(key, txt_0, value_0) VALUES('00 | 1 |
SELECT * from pg_stat_monitor_settings | 1 | Function Scan on pg_stat_monitor_settings
SELECT key, txt_0, value_0 FROM TBL_0 | 2 | Seq Scan on tbl_0
SELECT pg_stat_monitor_reset() | 1 | Result
UPDATE TBL_0 SET value_0 = $1 | 1 |
UPDATE TBL_0 SET value_0 = 1681692777 | 1 |
(6 rows)
Drop TABLE TBL_0;
@ -64,7 +64,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -97,12 +97,12 @@ select substr(query, 0,50) as query, calls, query_plan from pg_stat_monitor orde
query | calls | query_plan
---------------------------------------------------+-------+------------
CREATE TABLE TBL_0(key text primary key, txt_0 te | 1 |
INSERT INTO TBL_0(key, txt_0, value_0) VALUES($1, | 1 |
INSERT INTO TBL_0(key, txt_0, value_0) VALUES('00 | 1 |
SELECT * from pg_stat_monitor_settings | 1 |
SELECT key, txt_0, value_0 FROM TBL_0 | 2 |
SELECT pg_stat_monitor_reset() | 1 |
UPDATE TBL_0 SET value_0 = $1 | 1 |
select substr(query, $1,$2) as query, calls, quer | 1 |
UPDATE TBL_0 SET value_0 = 1681692777 | 1 |
select substr(query, 0,50) as query, calls, query | 1 |
(7 rows)
Drop extension pg_stat_monitor;

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -31,11 +31,11 @@ select datname, substr(query,0,100) as query, calls from pg_stat_monitor order b
---------+-----------------------------------------------------------------------------------------------------+-------
example | BEGIN | 10000
example | END | 10000
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP | 10000
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (21, 5, 983612, -3378, CURRENT_TIM | 10000
example | SELECT abalance FROM pgbench_accounts WHERE aid = 590644 | 10000
example | UPDATE pgbench_accounts SET abalance = abalance + -3378 WHERE aid = 983612 | 10000
example | UPDATE pgbench_branches SET bbalance = bbalance + -3038 WHERE bid = 3 | 10000
example | UPDATE pgbench_tellers SET tbalance = tbalance + -4835 WHERE tid = 68 | 10000
example | alter table pgbench_accounts add primary key (aid) | 1
example | alter table pgbench_branches add primary key (bid) | 1
example | alter table pgbench_tellers add primary key (tid) | 1
@ -47,8 +47,8 @@ select datname, substr(query,0,100) as query, calls from pg_stat_monitor order b
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfacto | 1
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
example | insert into pgbench_branches(bid,bbalance) values($1,$2) | 10
example | insert into pgbench_tellers(tid,bid,tbalance) values ($1,$2,$3) | 100
example | insert into pgbench_branches(bid,bbalance) values(1,0) | 10
example | insert into pgbench_tellers(tid,bid,tbalance) values (1,1,0) | 100
(20 rows)
SELECT pg_stat_monitor_reset();
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -89,7 +89,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -89,7 +89,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -115,7 +115,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -89,7 +89,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 1 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 1000 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 10000 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -89,7 +89,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 99999 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes

View File

@ -11,7 +11,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 10000 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -37,7 +37,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 1000 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -63,7 +63,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 100 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -89,7 +89,7 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | no | no | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
@ -103,56 +103,3 @@ SELECT * from pg_stat_monitor_settings;
pg_stat_monitor.pgsm_track_planning | no | no | Selects whether planning statistics are tracked. | | | yes, no | no
(15 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
SELECT * from pg_stat_monitor_settings;
name | value | default_value | description | minimum | maximum | options | restart
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 1 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 50 | | yes
pg_stat_monitor.pgsm_query_shared_buffer | 20 | 20 | Sets the maximum size of shared memory in (MB) used for query tracked by pg_stat_monitor. | 1 | 10000 | | yes
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | | yes
pg_stat_monitor.pgsm_enable_query_plan | no | no | Enable/Disable query plan monitoring | | | yes, no | no
pg_stat_monitor.pgsm_track | top | top | Selects which statements are tracked by pg_stat_monitor. | | | none, top, all | no
pg_stat_monitor.pgsm_extract_comments | no | no | Enable/Disable extracting comments from queries. | | | yes, no | no
pg_stat_monitor.pgsm_track_planning | no | no | Selects whether planning statistics are tracked. | | | yes, no | no
(15 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
SELECT * from pg_stat_monitor_settings;
name | value | default_value | description | minimum | maximum | options | restart
------------------------------------------+--------+---------------+----------------------------------------------------------------------------------------------------------+---------+------------+----------------+---------
pg_stat_monitor.pgsm_max | 100 | 100 | Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor. | 1 | 1000 | | yes
pg_stat_monitor.pgsm_query_max_len | 2048 | 2048 | Sets the maximum length of query. | 1024 | 2147483647 | | yes
pg_stat_monitor.pgsm_track_utility | yes | yes | Selects whether utility commands are tracked. | | | yes, no | no
pg_stat_monitor.pgsm_normalized_query | yes | yes | Selects whether save query in normalized format. | | | yes, no | no
pg_stat_monitor.pgsm_max_buckets | 10 | 10 | Sets the maximum number of buckets. | 1 | 10 | | yes
pg_stat_monitor.pgsm_bucket_time | 60 | 60 | Sets the time in seconds per bucket. | 1 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_min | 0 | 0 | Sets the time in millisecond. | 0 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_max | 100000 | 100000 | Sets the time in millisecond. | 10 | 2147483647 | | yes
pg_stat_monitor.pgsm_histogram_buckets | 10 | 10 | Sets the maximum number of histogram buckets | 2 | 50 | | yes
pg_stat_monitor.pgsm_query_shared_buffer | 20 | 20 | Sets the maximum size of shared memory in (MB) used for query tracked by pg_stat_monitor. | 1 | 10000 | | yes
pg_stat_monitor.pgsm_overflow_target | 1 | 1 | Sets the overflow target for pg_stat_monitor | 0 | 1 | | yes
pg_stat_monitor.pgsm_enable_query_plan | no | no | Enable/Disable query plan monitoring | | | yes, no | no
pg_stat_monitor.pgsm_track | top | top | Selects which statements are tracked by pg_stat_monitor. | | | none, top, all | no
pg_stat_monitor.pgsm_extract_comments | no | no | Enable/Disable extracting comments from queries. | | | yes, no | no
pg_stat_monitor.pgsm_track_planning | no | no | Selects whether planning statistics are tracked. | | | yes, no | no
(15 rows)
Drop extension pg_stat_monitor;

View File

@ -48,9 +48,9 @@ SELECT * from pg_stat_monitor_settings;
SELECT query, calls, total_exec_time, min_exec_time, max_exec_time, mean_exec_time, stddev_exec_time from pg_stat_monitor;
query | calls | total_exec_time | min_exec_time | max_exec_time | mean_exec_time | stddev_exec_time
---------------------------------------------------------------------------------------------------------------------------+-------+-----------------+---------------+---------------+----------------+------------------
SELECT * from pg_stat_monitor_settings | 2 | 0.0717 | 0.034 | 0.0377 | 0.0359 | 0.0018
SELECT query, calls, total_exec_time, min_exec_time, max_exec_time, mean_exec_time, stddev_exec_time from pg_stat_monitor | 1 | 0 | 0 | 0 | 0 | 0
SELECT pg_stat_monitor_reset() | 1 | 0.0338 | 0.0338 | 0.0338 | 0.0338 | 0
SELECT pg_stat_monitor_reset() | 1 | 0.0302 | 0.0302 | 0.0302 | 0.0302 | 0
SELECT * from pg_stat_monitor_settings | 2 | 0.069 | 0.0342 | 0.0349 | 0.0345 | 0.0004
(3 rows)
SELECT pg_stat_monitor_reset();