mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 14:06:20 +00:00
Major refactoring to support multiple new features.
Issue - (#16): PG-112: Change the column name "ip" to "client_ip" for readability purpose. Issue - (#17): PG-111: Show all the queries from complete and incomplete buckets. Issue - (#18): PG-108: Log the bucket start time. Issue - (#19): PG-99: Response time histogram. Issue - (#20): PG-97: Log CPU time for a query. Issue - (#21): PG-96: Show objects(tables) involved in the query. Issue - (#22): PG-93: Retain the bucket, and don't delete the bucket automatically. Issue - (#23): PG-91: Log queries of all the databases. Issue - (#24): PG-116: Restrict the query size. Issue - (#3) : README file update.
This commit is contained in:
208
README.md
208
README.md
@@ -18,11 +18,11 @@ There are two ways to install pg_stat_monitor. The first is by downloading the p
|
||||
##### Download and compile
|
||||
The latest release of pg_stat_monitor can be downloaded from this GitHub page:
|
||||
|
||||
https://github.com/Percona-Lab/pg_stat_monitor/releases
|
||||
https://github.com/Percona/pg_stat_monitor/releases
|
||||
|
||||
or it can be downloaded using the git:
|
||||
|
||||
git clone git://github.com/Percona-Lab/pg_stat_monitor.git
|
||||
git clone git://github.com/Percona/pg_stat_monitor.git
|
||||
|
||||
After downloading the code, set the path for the [PostgreSQL][1] binary:
|
||||
|
||||
@@ -57,46 +57,46 @@ There are four views, and complete statistics can be accessed using these views.
|
||||
##### pg_stat_monitor
|
||||
This is the main view which stores per query-based statistics, similar to pg_stat_statment with some additional columns.
|
||||
|
||||
\d pg_stat_monitor;
|
||||
View "public.pg_stat_monitor"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
---------------------+------------------+-----------+----------+---------
|
||||
userid | oid | | |
|
||||
dbid | oid | | |
|
||||
queryid | bigint | | |
|
||||
query | text | | |
|
||||
calls | bigint | | |
|
||||
total_time | double precision | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
stddev_time | double precision | | |
|
||||
rows | bigint | | |
|
||||
shared_blks_hit | bigint | | |
|
||||
shared_blks_read | bigint | | |
|
||||
shared_blks_dirtied | bigint | | |
|
||||
shared_blks_written | bigint | | |
|
||||
local_blks_hit | bigint | | |
|
||||
local_blks_read | bigint | | |
|
||||
local_blks_dirtied | bigint | | |
|
||||
local_blks_written | bigint | | |
|
||||
temp_blks_read | bigint | | |
|
||||
temp_blks_written | bigint | | |
|
||||
blk_read_time | double precision | | |
|
||||
blk_write_time | double precision | | |
|
||||
host | integer | | |
|
||||
hist_calls | text | | |
|
||||
hist_min_time | text | | |
|
||||
hist_max_time | text | | |
|
||||
hist_mean_time | text | | |
|
||||
slow_query | text | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
postgres=# \d pg_stat_monitor;
|
||||
View "public.pg_stat_monitor"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
---------------------+--------------------------+-----------+----------+---------
|
||||
bucket | oid | | |
|
||||
bucket_start_time | timestamp with time zone | | |
|
||||
userid | oid | | |
|
||||
dbid | oid | | |
|
||||
queryid | text | | |
|
||||
query | text | | |
|
||||
calls | bigint | | |
|
||||
total_time | double precision | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
stddev_time | double precision | | |
|
||||
int8 | bigint | | |
|
||||
shared_blks_hit | bigint | | |
|
||||
shared_blks_read | bigint | | |
|
||||
shared_blks_dirtied | bigint | | |
|
||||
shared_blks_written | bigint | | |
|
||||
local_blks_hit | bigint | | |
|
||||
local_blks_read | bigint | | |
|
||||
local_blks_dirtied | bigint | | |
|
||||
local_blks_written | bigint | | |
|
||||
temp_blks_read | bigint | | |
|
||||
temp_blks_written | bigint | | |
|
||||
blk_read_time | double precision | | |
|
||||
blk_write_time | double precision | | |
|
||||
host | bigint | | |
|
||||
client_ip | inet | | |
|
||||
resp_calls | text[] | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
tables_names | text[] | | |
|
||||
|
||||
|
||||
These are new column added to have more detail about the query.
|
||||
|
||||
host: Client IP or Hostname
|
||||
client_ip: Client IP or Hostname
|
||||
hist_calls: Hourly based 24 hours calls of query histogram
|
||||
hist_min_time: Hourly based 24 hours min time of query histogram
|
||||
Hist_max_time: Hourly based 24 hours max time of query histogram
|
||||
@@ -106,84 +106,72 @@ These are new column added to have more detail about the query.
|
||||
cpu_sys_time: CPU System time for that query.
|
||||
|
||||
|
||||
regression=# \d pg_stat_agg_database
|
||||
View "public.pg_stat_agg_database"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
----------------+--------------------------+-----------+----------+---------
|
||||
queryid | bigint | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
host | inet | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
hist_calls | text[] | | |
|
||||
hist_min_time | text[] | | |
|
||||
hist_max_time | text[] | | |
|
||||
hist_mean_time | text[] | | |
|
||||
first_log_time | timestamp with time zone | | |
|
||||
last_log_time | timestamp with time zone | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
slow_query | text | | |
|
||||
postgres=# \d pg_stat_agg_database
|
||||
View "public.pg_stat_agg_database"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
---------------+------------------+-----------+----------+---------
|
||||
bucket | oid | | |
|
||||
queryid | text | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
client_ip | inet | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
resp_calls | text[] | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
tables_names | text[] | | |
|
||||
|
||||
# \d pg_stat_agg_user
|
||||
View "public.pg_stat_agg_user"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
----------------+--------------------------+-----------+----------+---------
|
||||
queryid | bigint | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
host | inet | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
hist_calls | text[] | | |
|
||||
hist_min_time | text[] | | |
|
||||
hist_max_time | text[] | | |
|
||||
hist_mean_time | text[] | | |
|
||||
first_log_time | timestamp with time zone | | |
|
||||
last_log_time | timestamp with time zone | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
slow_query | text | | |
|
||||
postgres=# \d pg_stat_agg_user
|
||||
View "public.pg_stat_agg_user"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
---------------+------------------+-----------+----------+---------
|
||||
bucket | oid | | |
|
||||
queryid | text | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
client_ip | inet | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
resp_calls | text[] | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
tables_names | text[] | | |
|
||||
|
||||
# \d pg_stat_agg_host
|
||||
View "public.pg_stat_agg_host"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
----------------+--------------------------+-----------+----------+---------
|
||||
queryid | bigint | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
host | inet | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
hist_calls | text[] | | |
|
||||
hist_min_time | text[] | | |
|
||||
hist_max_time | text[] | | |
|
||||
hist_mean_time | text[] | | |
|
||||
first_log_time | timestamp with time zone | | |
|
||||
last_log_time | timestamp with time zone | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
slow_query | text | | |
|
||||
postgres=# \d pg_stat_agg_ip
|
||||
View "public.pg_stat_agg_ip"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
---------------+------------------+-----------+----------+---------
|
||||
bucket | oid | | |
|
||||
queryid | text | | |
|
||||
dbid | bigint | | |
|
||||
userid | oid | | |
|
||||
client_ip | inet | | |
|
||||
host | bigint | | |
|
||||
total_calls | integer | | |
|
||||
min_time | double precision | | |
|
||||
max_time | double precision | | |
|
||||
mean_time | double precision | | |
|
||||
resp_calls | text[] | | |
|
||||
cpu_user_time | double precision | | |
|
||||
cpu_sys_time | double precision | | |
|
||||
query | text | | |
|
||||
tables_names | text[] | | |
|
||||
|
||||
Examples
|
||||
1 - In this query we are getting the exact value of f1 which is '05:06:07-07' in the case of slow queries.
|
||||
1 - In this query we are getting the exact value of f1 which is '05:06:07-07' (special setting is required for this).
|
||||
|
||||
# select userid, queryid, query, slow_query, max_time, total_calls from pg_stat_agg_user;
|
||||
# select userid, queryid, query, max_time, total_calls from pg_stat_agg_user;
|
||||
-[ RECORD 1 ]----------------------------------------------------------------------------------------
|
||||
userid | 10
|
||||
queryid | -203926152419851453
|
||||
query | SELECT f1 FROM TIMETZ_TBL WHERE f1 < $1
|
||||
slow_query | SELECT f1 FROM TIMETZ_TBL WHERE f1 < '05:06:07-07';
|
||||
query | SELECT f1 FROM TIMETZ_TBL WHERE f1 < '05:06:07-07';
|
||||
max_time | 1.237875
|
||||
total_calls | 8
|
||||
|
||||
@@ -206,6 +194,6 @@ Copyright (c) 2006 - 2019, Percona LLC.
|
||||
See [`LICENSE`][2] for full details.
|
||||
|
||||
[1]: https://www.postgresql.org/
|
||||
[2]: https://github.com/Percona-Lab/pg_stat_monitor/blob/master/LICENSE
|
||||
[3]: https://github.com/Percona-Lab/pg_stat_monitor/issues/new
|
||||
[2]: https://github.com/Percona/pg_stat_monitor/blob/master/LICENSE
|
||||
[3]: https://github.com/Percona/pg_stat_monitor/issues/new
|
||||
[4]: CONTRIBUTING.md
|
||||
|
||||
Reference in New Issue
Block a user