@@ -148,75 +148,52 @@ pg_statio_user_tables:
148
148
149
149
# WARNING: This set of metrics can be very expensive on a busy server as every unique query executed will create an additional time series
150
150
pg_stat_statements :
151
- 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) WHERE t2.rolname != 'rdsadmin'"
152
- master : true
151
+ query : |
152
+ SELECT
153
+ pg_get_userbyid(userid) as user,
154
+ pg_database.datname,
155
+ pg_stat_statements.queryid,
156
+ pg_stat_statements.calls,
157
+ pg_stat_statements.total_time / 1000.0 as seconds_total,
158
+ pg_stat_statements.rows,
159
+ pg_stat_statements.blk_read_time / 1000.0 as block_read_seconds_total,
160
+ pg_stat_statements.blk_write_time / 1000.0 as block_write_seconds_total
161
+ FROM pg_stat_statements
162
+ JOIN pg_database
163
+ ON pg_database.oid = pg_stat_statements.dbid
164
+ WHERE
165
+ total_time > (
166
+ SELECT percentile_cont(0.1)
167
+ WITHIN GROUP (ORDER BY total_time)
168
+ FROM pg_stat_statements
169
+ )
170
+ ORDER BY seconds_total DESC
171
+ LIMIT 100
153
172
metrics :
154
- - rolname :
173
+ - user :
155
174
usage : " LABEL"
156
- description : " Name of user"
175
+ description : " The user who executed the statement "
157
176
- datname :
158
177
usage : " LABEL"
159
- description : " Name of database"
178
+ description : " The database in which the statement was executed "
160
179
- queryid :
161
180
usage : " LABEL"
162
- description : " Query ID "
181
+ description : " Internal hash code, computed from the statement's parse tree "
163
182
- calls :
164
183
usage : " COUNTER"
165
184
description : " Number of times executed"
166
- - total_time_seconds :
185
+ - seconds_total :
167
186
usage : " COUNTER"
168
- description : " Total time spent in the statement, in milliseconds"
169
- - min_time_seconds :
170
- usage : " GAUGE"
171
- description : " Minimum time spent in the statement, in milliseconds"
172
- - max_time_seconds :
173
- usage : " GAUGE"
174
- description : " Maximum time spent in the statement, in milliseconds"
175
- - mean_time_seconds :
176
- usage : " GAUGE"
177
- description : " Mean time spent in the statement, in milliseconds"
178
- - stddev_time_seconds :
179
- usage : " GAUGE"
180
- description : " Population standard deviation of time spent in the statement, in milliseconds"
187
+ description : " Total time spent in the statement, in seconds"
181
188
- rows :
182
189
usage : " COUNTER"
183
190
description : " Total number of rows retrieved or affected by the statement"
184
- - shared_blks_hit :
185
- usage : " COUNTER"
186
- description : " Total number of shared block cache hits by the statement"
187
- - shared_blks_read :
188
- usage : " COUNTER"
189
- description : " Total number of shared blocks read by the statement"
190
- - shared_blks_dirtied :
191
- usage : " COUNTER"
192
- description : " Total number of shared blocks dirtied by the statement"
193
- - shared_blks_written :
194
- usage : " COUNTER"
195
- description : " Total number of shared blocks written by the statement"
196
- - local_blks_hit :
197
- usage : " COUNTER"
198
- description : " Total number of local block cache hits by the statement"
199
- - local_blks_read :
200
- usage : " COUNTER"
201
- description : " Total number of local blocks read by the statement"
202
- - local_blks_dirtied :
203
- usage : " COUNTER"
204
- description : " Total number of local blocks dirtied by the statement"
205
- - local_blks_written :
206
- usage : " COUNTER"
207
- description : " Total number of local blocks written by the statement"
208
- - temp_blks_read :
209
- usage : " COUNTER"
210
- description : " Total number of temp blocks read by the statement"
211
- - temp_blks_written :
212
- usage : " COUNTER"
213
- description : " Total number of temp blocks written by the statement"
214
- - blk_read_time_seconds :
191
+ - block_read_seconds_total :
215
192
usage : " COUNTER"
216
- description : " Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero) "
217
- - blk_write_time_seconds :
193
+ description : " Total time the statement spent reading blocks, in seconds "
194
+ - block_write_seconds_total :
218
195
usage : " COUNTER"
219
- description : " Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero) "
196
+ description : " Total time the statement spent writing blocks, in seconds "
220
197
221
198
pg_process_idle :
222
199
query : |
0 commit comments