1 # Pre-defined queries of collectd's postgresql plugin.
3 # Do not edit this file. If you want to change any of the query definitions,
4 # overwrite them in collectd.conf instead.
6 # This file is distributed under the same terms as collectd itself.
9 Statement "SELECT count(*) AS count \
10 FROM pg_stat_activity \
22 Statement "SELECT xact_commit, xact_rollback \
23 FROM pg_stat_database \
30 InstancePrefix "commit"
31 ValuesFrom "xact_commit"
35 InstancePrefix "rollback"
36 ValuesFrom "xact_rollback"
41 Statement "SELECT sum(n_tup_ins) AS ins, \
42 sum(n_tup_upd) AS upd, \
43 sum(n_tup_del) AS del \
44 FROM pg_stat_user_tables;"
66 Statement "SELECT sum(n_tup_ins) AS ins, \
67 sum(n_tup_upd) AS upd, \
68 sum(n_tup_del) AS del, \
69 sum(n_tup_hot_upd) AS hot_upd \
70 FROM pg_stat_user_tables;"
89 InstancePrefix "hot_upd"
96 <Query queries_by_table>
97 Statement "SELECT schemaname, relname, \
101 FROM pg_stat_user_tables;"
106 InstancesFrom "schemaname" "relname"
112 InstancesFrom "schemaname" "relname"
118 InstancesFrom "schemaname" "relname"
125 <Query queries_by_table>
126 Statement "SELECT schemaname, relname, \
130 n_tup_hot_upd AS hot_upd \
131 FROM pg_stat_user_tables;"
136 InstancesFrom "schemaname" "relname"
142 InstancesFrom "schemaname" "relname"
148 InstancesFrom "schemaname" "relname"
153 InstancePrefix "hot_upd"
154 InstancesFrom "schemaname" "relname"
162 Statement "SELECT sum(seq_scan) AS seq, \
163 sum(seq_tup_read) AS seq_tup_read, \
164 sum(idx_scan) AS idx, \
165 sum(idx_tup_fetch) AS idx_tup_fetch \
166 FROM pg_stat_user_tables;"
175 InstancePrefix "seq_tup_read"
176 ValuesFrom "seq_tup_read"
185 InstancePrefix "idx_tup_fetch"
186 ValuesFrom "idx_tup_fetch"
191 Statement "SELECT sum(n_live_tup) AS live, sum(n_dead_tup) AS dead \
192 FROM pg_stat_user_tables;"
196 InstancePrefix "live"
201 InstancePrefix "dead"
208 <Query query_plans_by_table>
209 Statement "SELECT schemaname, relname, \
211 seq_tup_read AS seq_tup_read, \
213 idx_tup_fetch AS idx_tup_fetch \
214 FROM pg_stat_user_tables;"
219 InstancesFrom "schemaname" "relname"
224 InstancePrefix "seq_tup_read"
225 InstancesFrom "schemaname" "relname"
226 ValuesFrom "seq_tup_read"
231 InstancesFrom "schemaname" "relname"
236 InstancePrefix "idx_tup_fetch"
237 InstancesFrom "schemaname" "relname"
238 ValuesFrom "idx_tup_fetch"
242 <Query table_states_by_table>
243 Statement "SELECT schemaname, relname, \
244 n_live_tup AS live, n_dead_tup AS dead \
245 FROM pg_stat_user_tables;"
249 InstancePrefix "live"
250 InstancesFrom "schemaname" "relname"
255 InstancePrefix "dead"
256 InstancesFrom "schemaname" "relname"
264 Statement "SELECT coalesce(sum(heap_blks_read), 0) AS heap_read, \
265 coalesce(sum(heap_blks_hit), 0) AS heap_hit, \
266 coalesce(sum(idx_blks_read), 0) AS idx_read, \
267 coalesce(sum(idx_blks_hit), 0) AS idx_hit, \
268 coalesce(sum(toast_blks_read), 0) AS toast_read, \
269 coalesce(sum(toast_blks_hit), 0) AS toast_hit, \
270 coalesce(sum(tidx_blks_read), 0) AS tidx_read, \
271 coalesce(sum(tidx_blks_hit), 0) AS tidx_hit \
272 FROM pg_statio_user_tables;"
276 InstancePrefix "heap_read"
277 ValuesFrom "heap_read"
281 InstancePrefix "heap_hit"
282 ValuesFrom "heap_hit"
286 InstancePrefix "idx_read"
287 ValuesFrom "idx_read"
291 InstancePrefix "idx_hit"
296 InstancePrefix "toast_read"
297 ValuesFrom "toast_read"
301 InstancePrefix "toast_hit"
302 ValuesFrom "toast_hit"
306 InstancePrefix "tidx_read"
307 ValuesFrom "tidx_read"
311 InstancePrefix "tidx_hit"
312 ValuesFrom "tidx_hit"
316 <Query disk_io_by_table>
317 Statement "SELECT schemaname, relname, \
318 coalesce(heap_blks_read, 0) AS heap_read, \
319 coalesce(heap_blks_hit, 0) AS heap_hit, \
320 coalesce(idx_blks_read, 0) AS idx_read, \
321 coalesce(idx_blks_hit, 0) AS idx_hit, \
322 coalesce(toast_blks_read, 0) AS toast_read, \
323 coalesce(toast_blks_hit, 0) AS toast_hit, \
324 coalesce(tidx_blks_read, 0) AS tidx_read, \
325 coalesce(tidx_blks_hit, 0) AS tidx_hit \
326 FROM pg_statio_user_tables;"
330 InstancePrefix "heap_read"
331 InstancesFrom "schemaname" "relname"
332 ValuesFrom "heap_read"
336 InstancePrefix "heap_hit"
337 InstancesFrom "schemaname" "relname"
338 ValuesFrom "heap_hit"
342 InstancePrefix "idx_read"
343 InstancesFrom "schemaname" "relname"
344 ValuesFrom "idx_read"
348 InstancePrefix "idx_hit"
349 InstancesFrom "schemaname" "relname"
354 InstancePrefix "toast_read"
355 InstancesFrom "schemaname" "relname"
356 ValuesFrom "toast_read"
360 InstancePrefix "toast_hit"
361 InstancesFrom "schemaname" "relname"
362 ValuesFrom "toast_hit"
366 InstancePrefix "tidx_read"
367 InstancesFrom "schemaname" "relname"
368 ValuesFrom "tidx_read"
372 InstancePrefix "tidx_hit"
373 InstancesFrom "schemaname" "relname"
374 ValuesFrom "tidx_hit"
379 Statement "SELECT pg_database_size($1) AS size;"
389 # vim: set ft=config :