My DB is shrinking

Hi,
i noticed the past week my backups started reducing in size day after day and i discovered is the db file that is heavily shrinking (it was 1.8G now is 500M).
Do i have to worry about it? Is some background process that happen in january?
Thanks.

1 Like

I was ready to post exactly the same…

What version of HA Core? Have you updated recently? Does it shrink at set times (say, 4AM Sunday) or gradually all day/week?

I don’t recall that a database change was included in the 2025.1.x release, but I might have missed it.

Core 2024.11.3
MariaDB v.2.7.2

The automatic backup is set to run after the DB clean up, so the DB is as optimized as possible, which will also make it smaller.

It’s the docker version of HA on a RbPi and jcw… AutoBackup script.
I can’t say if it started with 2025.1.0 or at the begin of january with the old 2024.12.5.
I upgraded the 5th late night and did the first manual backup with encryption. This one is already less 10MB less then the 1st of january one. Then the 6th january failed because Autobackup needed an update, then the 7th one was already skinny and continued to shrink the next days and so on…

I use “Home Assistant Google Drive Backup” add-on for my backups and have older HA core.
Do you also use MariaDB database server?

I don’t know is the one integrated in the docker container.

BTW the db stabilized at around 500M from 1.8G and now it’s slowly increasing as usual. Compressed backup is reduced to just under 100MB from 240MB of december.
Energy data are there.
Sensors data are there.
It’s fine.
It seems.

Thanks for the update. Something to keep an eye on for sure. Here’s one theory: Maybe some entity went “chatty” on you for a while, filling up the database with frequent state changes. Then when you hit your keep_days, the routine to purge old records brought the database back down. Or, if the DB had been larger for a long time, maybe some chatty entity was removed or updated so it’s not spamming the database any more.