File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
config/pgwatch-prometheus Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -966,6 +966,34 @@ metrics:
966966 - wal_bytes
967967 - temp_bytes_read
968968 - temp_bytes_written
969+ pg_index_tuples :
970+ description : >
971+ Track tuple counts (live, dead, and total) for indexes using reltuples from pg_class.
972+ This metric provides insights into index tuple distribution and can help identify
973+ indexes that may benefit from maintenance operations.
974+ sqls :
975+ 11 : |
976+ select
977+ current_database() as tag_datname,
978+ n.nspname as tag_schemaname,
979+ t.relname as tag_tablename,
980+ i.relname as tag_indexname,
981+ i.reltuples as total_tuples,
982+ coalesce(pg_stat_get_live_tuples(t.oid), 0) as live_tuples,
983+ coalesce(pg_stat_get_dead_tuples(t.oid), 0) as dead_tuples
984+ from pg_class i
985+ join pg_index idx on idx.indexrelid = i.oid
986+ join pg_class t on t.oid = idx.indrelid
987+ join pg_namespace n on n.oid = i.relnamespace
988+ where i.relkind = 'i'
989+ and t.relkind = 'r'
990+ and n.nspname not in ('information_schema', 'pg_catalog')
991+ order by i.reltuples desc nulls last
992+ limit 5000
993+ gauges :
994+ - total_tuples
995+ - live_tuples
996+ - dead_tuples
969997 pg_stat_user_indexes :
970998 sqls :
971999 11 : |
@@ -1957,6 +1985,7 @@ presets:
19571985 pg_stat_wal_receiver : 30
19581986 pg_archiver : 30
19591987 pg_stat_user_tables : 30
1988+ pg_index_tuples : 30
19601989 pg_stat_user_indexes : 30
19611990 pg_stat_statements : 30
19621991 pg_stat_replication : 30
You can’t perform that action at this time.
0 commit comments