A PostgreSQL table generates a PostgreSQL Index Bloat alarm with a value greater than 100%, leading to concerns that:
Example alarm:
The index size for <table_name> is currently 121.08% of the total table size.
Foglight provides two separate PostgreSQL index-related alarms:
Evaluates the combined size of all indexes associated with a table.
Effective calculation:
idx_size_pct =
(
pg_indexes_size(relid)
/
pg_table_size(relid)
) * 100
Where:
pg_indexes_size(relid) = total size of all indexes on the table
pg_table_size(relid) = size of the table
Evaluates the size of a single index relative to its parent table.
Effective calculation:
sizePct =
(
pg_relation_size(index_oid)
/
pg_table_size(relid)
) * 100
Where:
pg_relation_size(index_oid) = size of the individual index
pg_table_size(relid) = size of the table
Because the PostgreSQL Index Bloat alarm uses the aggregate size of all indexes, the resulting percentage can exceed 100% even when every individual index is smaller than the table.
This behavior is expected.
The PostgreSQL Index Bloat alarm measures the ratio of:
Total Index Size
---------------- x 100
Table Size
and does not evaluate individual index size.
If the observed percentage is not useful for the environment:
Foglight collects PostgreSQL size information using native PostgreSQL size functions, including:
pg_relation_size()
pg_indexes_size()
pg_table_size()
pg_total_relation_size()
A value greater than 100% indicates that the combined size of all indexes exceeds the table size. This does not by itself indicate incorrect data collection or actual PostgreSQL index bloat.