95 lines
10 KiB
Plaintext
95 lines
10 KiB
Plaintext
CREATE EXTENSION pg_stat_monitor;
|
|
create table foo (id int generated by default as identity,col1 varchar(100) not null,primary key(id));
|
|
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 | 1 | 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 | no | no | Selects whether save query in normalized format. | | | yes, no | no
|
|
pg_stat_monitor.pgsm_max_buckets | 2 | 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 | 1 | 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 | 0 | 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 substr(query, 0, 50), length(query), bucket, queryid, calls, elevel, sqlcode, message from pg_stat_monitor;
|
|
substr | length | bucket | queryid | calls | elevel | sqlcode | message
|
|
--------+--------+--------+---------+-------+--------+---------+---------
|
|
(0 rows)
|
|
|
|
SELECT count(queryid) from pg_stat_monitor;
|
|
count
|
|
-------
|
|
0
|
|
(1 row)
|
|
|
|
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 | 1 | 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 | no | no | Selects whether save query in normalized format. | | | yes, no | no
|
|
pg_stat_monitor.pgsm_max_buckets | 2 | 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 | 1 | 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 substr(query, 0, 50), length(query), bucket, queryid, calls, elevel, sqlcode, message from pg_stat_monitor;
|
|
substr | length | bucket | queryid | calls | elevel | sqlcode | message
|
|
---------------------------------------------------+--------+--------+------------------+-------+--------+---------+---------
|
|
UPDATE TBL_2_81 SET value_0 = 1233558186, value_1 | 584 | 0 | 3701D68BEA093403 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1408 | 1 | 9E24F6C78B91466D | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1174 | 1 | DA018C53C04C08AE | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1210 | 1 | 2B90260D4BC8A0DD | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1264 | 1 | 202C5719118D470B | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1192 | 1 | F1FD09DE4F81249A | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1156 | 1 | 6293B3A1336BBE8B | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1282 | 1 | C7815236554A7720 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1300 | 1 | FFC2819A38F41A12 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1372 | 1 | 6957581EA501B313 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1354 | 1 | 600F171F94A7F721 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1426 | 1 | 278C46300D46D0A3 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1318 | 1 | 97D2167E4CB586A6 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1336 | 1 | 92C3EFFB72E5290C | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1228 | 1 | 38BD5BF75DFD7C17 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1246 | 1 | 155693EA64D27308 | 1 | 0 | |
|
|
SELECT key, txt_0, value_0, txt_1, value_1, txt_2 | 1390 | 1 | 363709BA30BC1F27 | 1 | 0 | |
|
|
(17 rows)
|
|
|
|
SELECT count(queryid) from pg_stat_monitor;
|
|
count
|
|
-------
|
|
18
|
|
(1 row)
|
|
|
|
Drop extension pg_stat_monitor;
|