Database bloat maintenance
This issue serves to track a ~Delta for GitLab.com as compared to the product.
For GitLab.com, we leveraged the
pg_repack extension to rebuild Postgres data structures to remove bloat (see Epic &29 (closed)). We created a ruby command line tool
gitlab-pgrepack that is able to suggest which structures need repacking and also execute the repacking in a relatively safe manner. However, it is not advisable to run repacking automatically in the background due to locking concerns. It needs to be run with supervision.
A possible solution to ship this with the product is to ship the
pg_repack extension with the omnibus database and otherwise point customers interested in running this kind of maintenance to