I wrote up a guide about pg_repack, and how it can be used to fix a misbehaving Pleroma/Rebased database: https://gitlab.com/soapbox-pub/rebased/-/snippets/2463995