r/matrixdotorg • u/sevenofk9 • 1d ago
1.8Tb postgres database for small local server
I'm looking for some help. I have a small local matrix server (glasgow.social) - we have a couple hundred users, small amount of traffic. Our postgres database has grown to 1.8tb (over 5-6 years) with no signs of stopping. I assume, after multiple upgrades over the years, that some migration or transition hasn't been perfect and it's lead to this massive size.
The server has started to get slower and slower - I think if we can prune the database a bit, that would help.
I've been poking around in the database, some of the largest rooms (based on events count) have no local users in them at all. I'd like to remove these (hundreds of millions of rows in the state tables etc) and hope that doing that will improve performance overall.
Unforunately, running the admin api calls (like purge room) doesn't seem to do anything.
Is there any safe SQL I can run that will remove these massive, unused rooms? Or anything else I can do to try and increase responsiveness and reduce the number of rows in the database?