=back
-The following predefined queries are available:
+The following predefined queries are available (the definitions can be found
+in the F<postgresql_default.conf> file which, by default, is available at
+C<I<prefix>/share/collectd/>):
=over 4
-=item B<database>
+=item B<backends>
-This query collects general database statistics, i.E<nbsp>e. the number of
-backends and committed and rolled-back transactions.
+This query collects the number of backends, i.E<nbsp>e. the number of
+connected clients.
-=item B<user_tables>
+=item B<transactions>
-This query collects user-table usage statistics, i.E<nbsp>e. the numbers of
-various table scans and the numbers of various table modifications.
+This query collects the numbers of committed and rolled-back transactions of
+the user tables.
-=item B<io_user_tables>
+=item B<queries>
-This query collects block access counts for user-tables.
+This query collects the numbers of various table modifications (i.E<nbsp>e.
+insertions, updates, deletions) of the user tables.
+
+=item B<query_plans>
+
+This query collects the numbers of various table scans and returned tuples of
+the user tables.
+
+=item B<table_states>
+
+This query collects the numbers of live and dead rows in the user tables.
+
+=item B<disk_io>
+
+This query collects disk block access counts for user tables.
=back
Specify a I<query> which should be executed for the database connection. This
may be any of the predefined or user-defined queries. If no such option is
-given, it defaults to "database", "user_tables" and "io_user_tables". Else,
-the specified queries are used only.
+given, it defaults to "backends", "transactions", "queries", "query_plans",
+"table_states", "disk_io". Else, the specified queries are used only.
=back
# Pre-defined queries of collectd's postgresql plugin.
-<Query database>
- Query "SELECT numbackends, xact_commit, xact_rollback \
- FROM pg_stat_database \
+<Query backends>
+ Query "SELECT count(*) \
+ FROM pg_stat_activity \
WHERE datname = $1;"
Param database
Column pg_numbackends
+</Query>
+
+<Query transactions>
+ Query "SELECT xact_commit, xact_rollback \
+ FROM pg_stat_database \
+ WHERE datname = $1;"
+
+ Param database
+
Column pg_xact commit
Column pg_xact rollback
</Query>
-<Query user_tables>
- Query "SELECT sum(seq_scan), sum(seq_tup_read), \
- sum(idx_scan), sum(idx_tup_fetch), \
- sum(n_tup_ins), sum(n_tup_upd), sum(n_tup_del), \
- sum(n_tup_hot_upd), sum(n_live_tup), sum(n_dead_tup) \
- FROM pg_stat_user_tables"
-
- Column pg_scan seq
- Column pg_scan seq_tup_read
- Column pg_scan idx
- Column pg_scan idx_tup_fetch
+<Query queries>
+ Query "SELECT sum(n_tup_ins), sum(n_tup_upd), sum(n_tup_del), \
+ sum(n_tup_hot_upd) \
+ FROM pg_stat_user_tables;"
+
Column pg_n_tup_c ins
Column pg_n_tup_c upd
Column pg_n_tup_c del
Column pg_n_tup_c hot_upd
+</Query>
+
+<Query query_plans>
+ Query "SELECT sum(seq_scan), sum(seq_tup_read), \
+ sum(idx_scan), sum(idx_tup_fetch) \
+ FROM pg_stat_user_tables;"
+
+ Column pg_scan seq
+ Column pg_scan seq_tup_read
+ Column pg_scan idx
+ Column pg_scan idx_tup_fetch
+</Query>
+
+<Query table_states>
+ Query "SELECT sum(n_live_tup), sum(n_dead_tup) \
+ FROM pg_stat_user_tables;"
+
Column pg_n_tup_g live
Column pg_n_tup_g dead
</Query>
-<Query io_user_tables>
+<Query disk_io>
Query "SELECT sum(heap_blks_read), sum(heap_blks_hit), \
sum(idx_blks_read), sum(idx_blks_hit), \
sum(toast_blks_read), sum(toast_blks_hit), \