Description
It is rather crucial, and I do not really see reasons not to include them. Few of the metrics that would be really helpful for monitoring performance, disk performance, hotspots, and other issues:
SELECT relname, last_vacuum, last_autovacuum, vacuum_count, autovacuum_count FROM pg_stat_user_tables;
SELECT relname, reltuples, relpages, n_dead_tup FROM pg_stat_user_tables;
SELECT pg_total_relation_size('x');
SELECT pg_table_size('x');
SELECT relname, relfrozenxid, reltuples, relpages FROM pg_class;
Plus few other counters from pg_stat_user_tables, i.e. seq_scan seq_tup_read idx_scan idx_tup_fetch n_tup_ins n_tup_upd n_tup_del n_tup_hot_upd n_live_tup n_dead_tup n_mod_since_analyze last_analyze last_autoanalyze analyze_count autoanalyze_count
Possible few extra other functions that I do not know about yet. (possibly things like toast column sizes, or number of columns per table - not that useful).
Adding precise row counts is also an option, to do automatically periodically.
They are all cheap to gather and export, and store. I prefer to have than not have them always, as during outages and performance issue, they allow me easily to compare historical values and see trends.
If somebody prefers not to have it (i.e. they have 10k+ relations or a lot of relations that are kind of temporary), it could be disabled by a flag (but enabled by default), or ability to set some regexp to filter tables).
Metrics should have both datname
and relname
as labels for all tables.