Reindex btree indexes after pg14 upgrade
Postgres 13 and 14 have improvements in btree, reducing the bloat growth. Particularly, as mentioned in the PG13 release notes:
More efficiently store duplicates in B-tree indexes (Anastasia Lubennikova, Peter Geoghegan)
This allows efficient B-tree indexing of low-cardinality columns by storing duplicate keys only once. Users upgrading with pg_upgrade will need to use REINDEX to make an existing index use this feature.
So to start benefiting from it, we need to rebuild btree indexes after upgrade. Some of them are going to be rebuilt with automated index maintenance process, but some might not be rebuilt for a long time.
We discussed that in the past, so I wanted just to create this issue not to forget to check the indexes after upgrade – I think we should rebuild all indexes routinely after the upgrade, it would be beneficial for performance. @rhenchen.gitlab @alexander-sosna @bshah11 what do you think?
(related to these issues: https://gitlab.com/gitlab-com/gl-infra/capacity-planning/-/issues/?sort=updated_desc&state=opened&search=bloat&first_page_size=20 – once we upgrade and rebuild indexes, I expect that the bloat growth for btree indexes should become much lower).