So I have a similar problem. I ran analyze-db.py, and it told me that "automation.automation_1", an automation I created for testing a while ago and don't need anymore, takes up over 90% of my events table.
But if I use purge_entities with this entity, nothing happens. At least for other entities I do get entries in the log file, but they are still there in the database.
I ended up just doing a
DELETE FROM events WHERE event_data LIKE '%automation.automation_1%'
Now I need to find a way to repack the database. there's not enough diskspace...
UPDATE: analyze-db.py is not really a good way to analyze the database, as it ignores all events that don't have an entity_id in their event_data (quite a few, and especially the state changes). The commands given here:
work much better, and you can easily modify them for ordering by byte size etc.
For large databases on underpowered systems, I found it more convenient to copy the database to my desktop (but stop homeassistant to avoid database corruption: ha core stop), and then work on it using DB Browser for sqlite. This also allows you to VACUUM the database (i.e., repack) even if you don't have enough space on the homeassistant drive (you need the size of the database as additional free space).
I was able to shrink my database from 29GB to 13GB (I like to keep a long history, so this already has 6 months). The culprit were mostly the Unifi bandwidth and uptime trackers.
I then used the hints here:
to shrink the virtualbox image size (using fstrim).