This is a common problem. There have been some very promising improvements to the Recorder database logic recently, but there are still some things you should do to streamline your database.
This FR and This WTH talk about the ability to selectively set retention periods by entity, rather than one-size-fits-all, as in your 30 day example. Clearly there’s a need to retain some data much longer than others. Please vote for those if you agree.
There have been some complaints, FRs and WTHs written relating to a recent change to the History page, which no longer shows “all” entities. Before the change, that was a great way to see which entities are recording a lot of state changes in the database. Excluding those would give you the most “bang for the buck” reducing database writes and size. Hopefully this oversight is corrected and you can use the History page this way again soon. Until then you can go through your list of entities and surmise which ones might be helpful to retain and which can be excluded.
Once you’ve got your excludes or includes in config, and your purge_keep_days set where you want it, you can use the recorder:purge
service to clean up and reduce the size of (repack) your database file itself. Note: To select the repack option, you need to tick the check box and turn on the slider button or the repack won’t happen.