Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Comment out inefficient pg_stat_statements metric (#3039)
Browse files Browse the repository at this point in the history
* Comment out inefficient pg_stat_statements metric

* Minor tweaks
  • Loading branch information
DimitarPetrov authored Apr 27, 2023
1 parent 98720a4 commit 26b0369
Showing 1 changed file with 51 additions and 70 deletions.
121 changes: 51 additions & 70 deletions chart/compass/charts/prometheus-postgres-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,76 +223,57 @@ config:
usage: "GAUGE"
description: "Disk space used by the database"
pg_stat_statements:
query: "SELECT t2.rolname, t3.datname, queryid, calls, total_time / 1000 as total_time_seconds, min_time / 1000 as min_time_seconds, max_time / 1000 as max_time_seconds, mean_time / 1000 as mean_time_seconds, stddev_time / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements t1 join pg_roles t2 on (t1.userid=t2.oid) join pg_database t3 on (t1.dbid=t3.oid)"
master: true
metrics:
- rolname:
usage: "LABEL"
description: "Name of user"
- datname:
usage: "LABEL"
description: "Name of database"
- queryid:
usage: "LABEL"
description: "Query ID"
- calls:
usage: "COUNTER"
description: "Number of times executed"
- total_time_seconds:
usage: "COUNTER"
description: "Total time spent in the statement, in milliseconds"
- min_time_seconds:
usage: "GAUGE"
description: "Minimum time spent in the statement, in milliseconds"
- max_time_seconds:
usage: "GAUGE"
description: "Maximum time spent in the statement, in milliseconds"
- mean_time_seconds:
usage: "GAUGE"
description: "Mean time spent in the statement, in milliseconds"
- stddev_time_seconds:
usage: "GAUGE"
description: "Population standard deviation of time spent in the statement, in milliseconds"
- rows:
usage: "COUNTER"
description: "Total number of rows retrieved or affected by the statement"
- shared_blks_hit:
usage: "COUNTER"
description: "Total number of shared block cache hits by the statement"
- shared_blks_read:
usage: "COUNTER"
description: "Total number of shared blocks read by the statement"
- shared_blks_dirtied:
usage: "COUNTER"
description: "Total number of shared blocks dirtied by the statement"
- shared_blks_written:
usage: "COUNTER"
description: "Total number of shared blocks written by the statement"
- local_blks_hit:
usage: "COUNTER"
description: "Total number of local block cache hits by the statement"
- local_blks_read:
usage: "COUNTER"
description: "Total number of local blocks read by the statement"
- local_blks_dirtied:
usage: "COUNTER"
description: "Total number of local blocks dirtied by the statement"
- local_blks_written:
usage: "COUNTER"
description: "Total number of local blocks written by the statement"
- temp_blks_read:
usage: "COUNTER"
description: "Total number of temp blocks read by the statement"
- temp_blks_written:
usage: "COUNTER"
description: "Total number of temp blocks written by the statement"
- blk_read_time_seconds:
usage: "COUNTER"
description: "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
- blk_write_time_seconds:
usage: "COUNTER"
description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
#WARNING:
# This set of metrics can be very expensive on a busy server as every
# unique query executed will create an additional time series#
#pg_stat_statements:
# query: |
# SELECT
# pg_get_userbyid(userid) as user,
# pg_database.datname,
# pg_stat_statements.queryid,
# pg_stat_statements.calls as calls_total,
# pg_stat_statements.total_time / 1000.0 as seconds_total,
# pg_stat_statements.rows as rows_total,
# pg_stat_statements.blk_read_time / 1000.0 as block_read_seconds_total,
# pg_stat_statements.blk_write_time / 1000.0 as block_write_seconds_total
# FROM pg_stat_statements
# JOIN pg_database
# ON pg_database.oid = pg_stat_statements.dbid
# WHERE
# total_time > (
# SELECT percentile_cont(0.1)
# WITHIN GROUP (ORDER BY total_time)
# FROM pg_stat_statements
# )
# ORDER BY seconds_total DESC
# LIMIT 100
# metrics:
# - user:
# usage: "LABEL"
# description: "The user who executed the statement"
# - datname:
# usage: "LABEL"
# description: "The database in which the statement was executed"
# - queryid:
# usage: "LABEL"
# description: "Internal hash code, computed from the statement's parse tree"
# - calls_total:
# usage: "COUNTER"
# description: "Number of times executed"
# - seconds_total:
# usage: "COUNTER"
# description: "Total time spent in the statement, in seconds"
# - rows_total:
# usage: "COUNTER"
# description: "Total number of rows retrieved or affected by the statement"
# - block_read_seconds_total:
# usage: "COUNTER"
# description: "Total time the statement spent reading blocks, in seconds"
# - block_write_seconds_total:
# usage: "COUNTER"
# description: "Total time the statement spent writing blocks, in seconds"
compass_director_tenants_total:
query: "SELECT COUNT(ID) as quantity FROM business_tenant_mappings;"
Expand Down

0 comments on commit 26b0369

Please sign in to comment.