My home assistant DB is very large, how to check its content (and then reduce it)?

Hi, I have a DB that is GB large, and wish to reduce its size, how to check the inside (I don’t know much about DB)?
Overall my devices are around 100 (although with lots of sensors and components)

For the moment this is my configuration, any clue on how to reduce the size improving the config?

recorder:
 # db_url: /backup
  purge_interval: 2
  purge_keep_days: 3
  include:
    domains:
      - sensor
      - switch
      - light
      - binary_sensor
    entities:
      - image_processing.living_room_person_detection
      - image_processing.office_room_person_detection
      - image_processing.kitchen_room_person_detection
      - lock.home_door
  exclude:
    domains:
      - automation
      - weblink
      - updater
      - input_boolean
      - input_number
    entities:
      - sensor.date
      - sensor.time
      - sensor.last_boot
      - sun.sun

Assuming you are running a standard sqlite database, any sqlite tool, google them.

I use MariaDB as it is much faster for me then running the built-in recorder. However I have read that you can purge the database every x days or after every x days.


I haven’t used this before in my setup as I use an external DB which has plenty of space (however I might add this soon as it makes the DB slow and indeed extremely huge, over 20GB here already and that is from only a few months).

If you are interested in using MariaDB you can check it out here:

You can also exclude event_types:

I provide examples of SQL statements to purge unwanted entries from the database in this post:

3 Likes