Strange recorder behaviour

Since morning I observe very strange recorder behaviour; it records events for few minutes only and then stops for ~hour or so… Restart of HA helps for just few minutes, it stops again…Same with restart of MariaDB instance.

I’m using MariaDB configured on Synology NAS and so far it was very stable and fast setup. My DB is currently ~37GB, keeping 31 days of history for almost all sensors (with exception of few SNMP sensors updated every second) and is running on dedicated SSD volume on my NAS.

However, I noticed that running any queries from phpMyAdmin takes ages or does not complete at all (like sorting events by creation date/time). Also within HA itself loading of the history (one that is available, from past days) is waaaay slower than it was (~1 minute instead of 3 seconds). So I’d rather blame MariaDB for issues than HA, especially that I made no updates/changes recently.

Since I’m not DB guy, any advice on how to strat troubleshooting this? Sort of DB maintenance routine or repair? I’d prefer to avoid rebuilding the DB from scratch, since some charts I use in front end or automations rely on history.

EDIT: I tried to free up some space (maybe DB is too large) running recorder_purge and shortening stored history to 15 days, but it also seems not to work… I still see whole history of past 31 days.