Database Growing Huge

Hello,

I have been researching this topic for a while here and have tried to adding the recorder option to my configuration.yaml file, but the database does not resize. I am currently using the default database ( home-assistant_v2.db).

Having a large database has been causing poor performance with HA.

Do you have any other suggestions?
Have modified this to keep less days and even repack, but the size still stays the same.

recorder:
  # Delete events and states older than 2 weeks
  purge_keep_days: 14
  purge_interval: 1

Just shutdown HA delete the database file and restart again. Also delete the home-assistant.log file while you’re there.

What platform is HA running in.

Thanks for the reply! I am running on Raspbarian.

I actually have deleted the database and within a week or so, it climbs back to 2gb.

The default value of purge_keep_days is actually 10, so with your configuration you’re allowing the DB to grow larger than before.

You can try reducing the number of days to less than 10, but the DB could still remain the same size or even grow larger over time as you add more components and entities. A better approach is to include and/or exclude only the entities you actually want/don’t want to record.

1 Like

Thanks! Using the below, history, logbook are still being populated.

recorder:
  exclude:
    entities:
      - automation.automation_name

logbook:
  exclude:
    entities:
      - automation.automation_name

history:
  exclude:
    entities:
      - sensor.time
      - automation.automation_name

You really have an automation named automation.auotmation_name?

Haha, no! Just being generic.

If you have alot of items then it will always be a large database. I personally only include what I want, which ends up being around 100 items, that database at 10 days was around 2gb. More items, more days = larger file. I now store about 200 items and 30 days and I sit around 18gb

1 Like