# Pre-defined queries of collectd's postgresql plugin.
Statement "SELECT count(*) AS count \
FROM pg_stat_activity \
WHERE datname = $1;"
Param database
Type "pg_numbackends"
ValuesFrom "count"
Statement "SELECT xact_commit, xact_rollback \
FROM pg_stat_database \
WHERE datname = $1;"
Param database
Type "pg_xact"
InstancePrefix "commit"
ValuesFrom "xact_commit"
Type "pg_xact"
InstancePrefix "rollback"
ValuesFrom "xact_rollback"
Statement "SELECT sum(n_tup_ins) AS ins, \
sum(n_tup_upd) AS upd, \
sum(n_tup_del) AS del \
FROM pg_stat_user_tables;"
Type "pg_n_tup_c"
InstancePrefix "ins"
ValuesFrom "ins"
Type "pg_n_tup_c"
InstancePrefix "upd"
ValuesFrom "upd"
Type "pg_n_tup_c"
InstancePrefix "del"
ValuesFrom "del"
MaxPGVersion 80299
Statement "SELECT sum(n_tup_ins) AS ins, \
sum(n_tup_upd) AS upd, \
sum(n_tup_del) AS del, \
sum(n_tup_hot_upd) AS hot_upd \
FROM pg_stat_user_tables;"
Type "pg_n_tup_c"
InstancePrefix "ins"
ValuesFrom "ins"
Type "pg_n_tup_c"
InstancePrefix "upd"
ValuesFrom "upd"
Type "pg_n_tup_c"
InstancePrefix "del"
ValuesFrom "del"
Type "pg_n_tup_c"
InstancePrefix "hot_upd"
ValuesFrom "hot_upd"
MinPGVersion 80300
Statement "SELECT sum(seq_scan) AS seq, \
sum(seq_tup_read) AS seq_tup_read, \
sum(idx_scan) AS idx, \
sum(idx_tup_fetch) AS idx_tup_fetch \
FROM pg_stat_user_tables;"
Type "pg_scan"
InstancePrefix "seq"
ValuesFrom "seq"
Type "pg_scan"
InstancePrefix "seq_tup_read"
ValuesFrom "seq_tup_read"
Type "pg_scan"
InstancePrefix "idx"
ValuesFrom "idx"
Type "pg_scan"
InstancePrefix "idx_tup_fetch"
ValuesFrom "idx_tup_fetch"
Statement "SELECT sum(n_live_tup) AS live, sum(n_dead_tup) AS dead \
FROM pg_stat_user_tables;"
Type "pg_n_tup_g"
InstancePrefix "live"
ValuesFrom "live"
Type "pg_n_tup_g"
InstancePrefix "dead"
ValuesFrom "dead"
MinPGVersion 80300
Statement "SELECT sum(heap_blks_read) AS heap_read, \
sum(heap_blks_hit) AS heap_hit, \
sum(idx_blks_read) AS idx_read, \
sum(idx_blks_hit) AS idx_hit, \
sum(toast_blks_read) AS toast_read, \
sum(toast_blks_hit) AS toast_hit, \
sum(tidx_blks_read) AS tidx_read, \
sum(tidx_blks_hit) AS tidx_hit \
FROM pg_statio_user_tables;"
Type "pg_blks"
InstancePrefix "heap_read"
ValuesFrom "heap_read"
Type "pg_blks"
InstancePrefix "heap_hit"
ValuesFrom "heap_hit"
Type "pg_blks"
InstancePrefix "idx_read"
ValuesFrom "idx_read"
Type "pg_blks"
InstancePrefix "idx_hit"
ValuesFrom "idx_hit"
Type "pg_blks"
InstancePrefix "toast_read"
ValuesFrom "toast_read"
Type "pg_blks"
InstancePrefix "toast_hit"
ValuesFrom "toast_hit"
Type "pg_blks"
InstancePrefix "tidx_read"
ValuesFrom "tidx_read"
Type "pg_blks"
InstancePrefix "tidx_hit"
ValuesFrom "tidx_hit"
Statement "SELECT pg_database_size($1) AS size;"
Param database
Type pg_db_size
ValuesFrom "size"
# vim: set ft=config :