Home-assistant_v2.db adds tables 'states_temp_1234567890'

Hi
I have a problem with my home-assistant_v2.db database, which grows…
Currently around 26GB, and my home-assistant_v2.db-wal mostly around 13GB.

I have noticed that my home-assistant_v2.db table-list increases with tables called ‘states_temp_1234567890’ (timestamp I guess).
Have tried to delete these, but thety slowly comes again.

Suspect there is something corrupt in the DB, but don’t know how to fix/repair.

Running on VM in proxmox.

Any suggestions?

Thanks

Managed to find out that the home-assistant_v2.db itself was corrupt.

Steps to solve:

  • Stop HA core
  • Copy ‘home-assistant_v2.db’ to local pc
  • Export entire db to SQL file
  • Recreate new db by importing SQL file
  • Clean up the database (removing old data from ‘events’ and ‘states’ tables)
  • Run ‘VACUUM;’
  • Replace db on HA server with new one
  • Restart HA core

Now my db went from ~26GB to 4GB and not seeing errors in log anymore :slightly_smiling_face: