From 9fb4a6196c37e47bb4f4164c93c225658540a92b Mon Sep 17 00:00:00 2001 From: Vadim Yalovets Date: Thu, 14 Mar 2019 15:10:54 +0200 Subject: [PATCH] PMM-3436 investigate some dashboards for PostgreSQL --- queries.yaml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/queries.yaml b/queries.yaml index 1ffba7d5a..1d1d6f57a 100644 --- a/queries.yaml +++ b/queries.yaml @@ -88,3 +88,65 @@ pg_database: - size: usage: "GAUGE" description: "Disk space used by the database" + +pg_stat_statements: + query: "SELECT + pg_get_userbyid(userid) as user, + pg_database.datname, + pg_stat_statements.queryid, + pg_stat_statements.query, + pg_stat_statements.calls, + pg_stat_statements.total_time as time_milliseconds, + pg_stat_statements.rows, + pg_stat_statements.shared_blks_hit, + pg_stat_statements.shared_blks_read, + pg_stat_statements.shared_blks_dirtied, + pg_stat_statements.shared_blks_written, + pg_stat_statements.local_blks_hit, + pg_stat_statements.local_blks_read, + pg_stat_statements.local_blks_dirtied, + pg_stat_statements.local_blks_written, + pg_stat_statements.temp_blks_read, + pg_stat_statements.temp_blks_written, + pg_stat_statements.blk_read_time, + pg_stat_statements.blk_write_time + FROM pg_stat_statements + JOIN pg_database + ON pg_database.oid = pg_stat_statements.dbid" + 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" + - query: + usage: "LABEL" + description: "Processed query" + - calls: + usage: "COUNTER" + description: "Number of times executed" + - time_milliseconds: + usage: "COUNTER" + description: "Total 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"