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 coalesce(sum(n_tup_ins), 0) AS ins, \
42 coalesce(sum(n_tup_upd), 0) AS upd, \
43 coalesce(sum(n_tup_del), 0) AS del \
44 FROM pg_stat_user_tables;"
66 Statement "SELECT coalesce(sum(n_tup_ins), 0) AS ins, \
67 coalesce(sum(n_tup_upd), 0) AS upd, \
68 coalesce(sum(n_tup_del), 0) AS del, \
69 coalesce(sum(n_tup_hot_upd), 0) 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 coalesce(sum(seq_scan), 0) AS seq, \
163 coalesce(sum(seq_tup_read), 0) AS seq_tup_read, \
164 coalesce(sum(idx_scan), 0) AS idx, \
165 coalesce(sum(idx_tup_fetch), 0) 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 coalesce(sum(n_live_tup), 0) AS live, \
192 coalesce(sum(n_dead_tup), 0) AS dead \
193 FROM pg_stat_user_tables;"
197 InstancePrefix "live"
202 InstancePrefix "dead"
209 <Query query_plans_by_table>
210 Statement "SELECT schemaname, relname, \
211 coalesce(seq_scan, 0) AS seq, \
212 coalesce(seq_tup_read, 0) AS seq_tup_read, \
213 coalesce(idx_scan, 0) AS idx, \
214 coalesce(idx_tup_fetch, 0) AS idx_tup_fetch \
215 FROM pg_stat_user_tables;"
220 InstancesFrom "schemaname" "relname"
225 InstancePrefix "seq_tup_read"
226 InstancesFrom "schemaname" "relname"
227 ValuesFrom "seq_tup_read"
232 InstancesFrom "schemaname" "relname"
237 InstancePrefix "idx_tup_fetch"
238 InstancesFrom "schemaname" "relname"
239 ValuesFrom "idx_tup_fetch"
243 <Query table_states_by_table>
244 Statement "SELECT schemaname, relname, \
245 n_live_tup AS live, n_dead_tup AS dead \
246 FROM pg_stat_user_tables;"
250 InstancePrefix "live"
251 InstancesFrom "schemaname" "relname"
256 InstancePrefix "dead"
257 InstancesFrom "schemaname" "relname"
265 Statement "SELECT coalesce(sum(heap_blks_read), 0) AS heap_read, \
266 coalesce(sum(heap_blks_hit), 0) AS heap_hit, \
267 coalesce(sum(idx_blks_read), 0) AS idx_read, \
268 coalesce(sum(idx_blks_hit), 0) AS idx_hit, \
269 coalesce(sum(toast_blks_read), 0) AS toast_read, \
270 coalesce(sum(toast_blks_hit), 0) AS toast_hit, \
271 coalesce(sum(tidx_blks_read), 0) AS tidx_read, \
272 coalesce(sum(tidx_blks_hit), 0) AS tidx_hit \
273 FROM pg_statio_user_tables;"
277 InstancePrefix "heap_read"
278 ValuesFrom "heap_read"
282 InstancePrefix "heap_hit"
283 ValuesFrom "heap_hit"
287 InstancePrefix "idx_read"
288 ValuesFrom "idx_read"
292 InstancePrefix "idx_hit"
297 InstancePrefix "toast_read"
298 ValuesFrom "toast_read"
302 InstancePrefix "toast_hit"
303 ValuesFrom "toast_hit"
307 InstancePrefix "tidx_read"
308 ValuesFrom "tidx_read"
312 InstancePrefix "tidx_hit"
313 ValuesFrom "tidx_hit"
317 <Query disk_io_by_table>
318 Statement "SELECT schemaname, relname, \
319 coalesce(heap_blks_read, 0) AS heap_read, \
320 coalesce(heap_blks_hit, 0) AS heap_hit, \
321 coalesce(idx_blks_read, 0) AS idx_read, \
322 coalesce(idx_blks_hit, 0) AS idx_hit, \
323 coalesce(toast_blks_read, 0) AS toast_read, \
324 coalesce(toast_blks_hit, 0) AS toast_hit, \
325 coalesce(tidx_blks_read, 0) AS tidx_read, \
326 coalesce(tidx_blks_hit, 0) AS tidx_hit \
327 FROM pg_statio_user_tables;"
331 InstancePrefix "heap_read"
332 InstancesFrom "schemaname" "relname"
333 ValuesFrom "heap_read"
337 InstancePrefix "heap_hit"
338 InstancesFrom "schemaname" "relname"
339 ValuesFrom "heap_hit"
343 InstancePrefix "idx_read"
344 InstancesFrom "schemaname" "relname"
345 ValuesFrom "idx_read"
349 InstancePrefix "idx_hit"
350 InstancesFrom "schemaname" "relname"
355 InstancePrefix "toast_read"
356 InstancesFrom "schemaname" "relname"
357 ValuesFrom "toast_read"
361 InstancePrefix "toast_hit"
362 InstancesFrom "schemaname" "relname"
363 ValuesFrom "toast_hit"
367 InstancePrefix "tidx_read"
368 InstancesFrom "schemaname" "relname"
369 ValuesFrom "tidx_read"
373 InstancePrefix "tidx_hit"
374 InstancesFrom "schemaname" "relname"
375 ValuesFrom "tidx_hit"
380 Statement "SELECT pg_database_size($1) AS size;"
390 # vim: set ft=config :