integrations-core icon indicating copy to clipboard operation
integrations-core copied to clipboard

[postgres] postgresql.index_bloat metric is incorrect for B-tree indexes

Open marclegay opened this issue 6 months ago • 0 comments

The postgresql.index_bloat metric appears to be incorrect for B-tree indexes.

The query currently used to collect this metric assumes that all columns of the table are included in the index, which is not generally true for B-tree indexes. As a result, the bloat estimation is not accurate at all.

The comment above the query references this page: https://wiki.postgresql.org/wiki/Show_database_bloat — which in turn links to a more appropriate query for estimating B-tree index bloat: https://github.com/ioguix/pgsql-bloat-estimation/tree/master/btree

The author of the B-tree bloat estimation query has also written blog posts discussing the differences in estimation methods: https://blog.ioguix.net/tag/bloat/

marclegay avatar Jun 06 '25 12:06 marclegay