Skip to content

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

Open
@marclegay

Description

@marclegay

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions