mariaDB only 10 days?

Good afternoon. I wanted to have a longer history in my home assistant system, that’s why I installed MariaDB. already set up, but the story only appears to me for 10 days. someone can help me? thank you so much

1 Like

You need to modify the purge_keep_days setting which defaults to 10 days.

Thank you very much

how do i spend indefinite time?

I don’t know if you can. I mean why would you? That database would be insanely big.

yes… i agree with you… but i need a way to save the data and be able to see it several years from now

Then I’d suggest doing a dump/backup of the database. Years of data is going to be an issue.

and what is the best method to later be able to consult this database?

Honestly not sure. You may want to open your own topic as I’m not sure the best way to maintain years worth of HASS data. Most people want a month or 2 tops. Maybe someone else out there has done years worth of data. I have not.

Influxdb/Graffana.
There is an addon for that.

What these fine folks are getting at is its not really recommended to use the HA DB as your long-term storage solution. Changing the DB technology from SQLite to MariaDB doesn’t change that fact. There is no way to tell HA to store History data indefinitely for a reason, because its not recommended to have HA store many years worth of data in its DB.

If you want to be able to analyze years worth of data you should look to replicate that data somewhere else. InfluxDB is pretty good at this task and lots of data analysis tools are able to integrate with it. Plus HA has an InfluxDB Integration that makes it really easy to push all history data to Influx.

There is also a convenient InfluxDB addon although if you really want many years worth of all your HA history data you might want to think about using a dedicated machine for that. I mean that is A LOT of data. Especially if you’re running on a raspberry pi, you’re going to need something with real hard drives, not an SDCard or an SSD over USB. You can still browse that data from HA by installing the Grafana add-on but actually storing that data and making it possible to query quickly will take some thinking.

Or alternatively set up something like a nightly export process for the DB. Migrate that data to any LTS solution you want, whatever you find easiest given the tools you plan to use to analyze it.

Btw not sure if you’ve seen this but there’s a Data Science Portal for HA with help for getting started with that in HA. There’s also an analytics channel in the HA Discord where you can talk through some of the problems you’re trying to solve and get advice. You might find those helpful.

Thank you all.

I will make a monthly backup of all data and when I need to search, I use software external to HA, or even a plugin.