@@ -88,3 +88,65 @@ pg_database:
88
88
- size :
89
89
usage : " GAUGE"
90
90
description : " Disk space used by the database"
91
+
92
+ pg_stat_statements :
93
+ query : " SELECT
94
+ pg_get_userbyid(userid) as user,
95
+ pg_database.datname,
96
+ pg_stat_statements.queryid,
97
+ pg_stat_statements.query,
98
+ pg_stat_statements.calls,
99
+ pg_stat_statements.total_time as time_milliseconds,
100
+ pg_stat_statements.rows,
101
+ pg_stat_statements.shared_blks_hit,
102
+ pg_stat_statements.shared_blks_read,
103
+ pg_stat_statements.shared_blks_dirtied,
104
+ pg_stat_statements.shared_blks_written,
105
+ pg_stat_statements.local_blks_hit,
106
+ pg_stat_statements.local_blks_read,
107
+ pg_stat_statements.local_blks_dirtied,
108
+ pg_stat_statements.local_blks_written,
109
+ pg_stat_statements.temp_blks_read,
110
+ pg_stat_statements.temp_blks_written,
111
+ pg_stat_statements.blk_read_time,
112
+ pg_stat_statements.blk_write_time
113
+ FROM pg_stat_statements
114
+ JOIN pg_database
115
+ ON pg_database.oid = pg_stat_statements.dbid"
116
+ metrics :
117
+ - user :
118
+ usage : " LABEL"
119
+ description : " The user who executed the statement"
120
+ - datname :
121
+ usage : " LABEL"
122
+ description : " The database in which the statement was executed"
123
+ - queryid :
124
+ usage : " LABEL"
125
+ description : " Internal hash code, computed from the statement's parse tree"
126
+ - query :
127
+ usage : " LABEL"
128
+ description : " Processed query"
129
+ - calls :
130
+ usage : " COUNTER"
131
+ description : " Number of times executed"
132
+ - time_milliseconds :
133
+ usage : " COUNTER"
134
+ description : " Total time spent in the statement, in milliseconds"
135
+ - rows :
136
+ usage : " COUNTER"
137
+ description : " Total number of rows retrieved or affected by the statement"
138
+ - shared_blks_hit :
139
+ usage : " COUNTER"
140
+ description : " Total number of shared block cache hits by the statement"
141
+ - shared_blks_read :
142
+ usage : " COUNTER"
143
+ description : " Total number of shared blocks read by the statement"
144
+ - shared_blks_dirtied :
145
+ usage : " COUNTER"
146
+ description : " Total number of shared blocks dirtied by the statement"
147
+ - shared_blks_written :
148
+ usage : " COUNTER"
149
+ description : " Total number of shared blocks written by the statement"
150
+ - local_blks_hit :
151
+ usage : " COUNTER"
152
+ description : " Total number of local block cache hits by the statement"
0 commit comments