clarkwinkelmann facing similar issue. We ( team ) are in the middle of "diving deep" into this,troubleshooting this and comming up with some useful sdolution.
Unfortunately, this seems to be issue related not so much to Flarum, but to underpowering DB.
Please note that this problem stops once you migrate your DB to external one ( say, on AWS/GCP/Azure ).