Database optimization

I’m in the process of optimization off my database.
2 years ago i updated the default database to mariaDB.

Know i’m heaving influx database also installed, primari for the long term data (energy)

But know i want to know if i purge my database so it won’t store data older than 30 days, i will lose my history from the past 2 year.

Is there a way to copy the important data from mariadb to influx ?

is HA so smart that it knows where to get the history data from, so i could compare data from the energy dashboard.

I found this tutorial but can’t get my answers

before proceding and setting purge time i need to know that my history data is save.

HA has two categories of data (not counting metadata): state and long-term statistics. State data is kept for x days as specified by purge_keep_days on the recorder integration, which defaults to 10. Long-term statistics (which includes energy data) is kept forever.

So unless you currently have purge_keep_days set to 730 (2 years), you won’t lose anything. And if you haven’t specified purge_keep_days, setting it to 30 will likely increase your database by a factor of nearly 3.

@michaelblight that clears a bit.
Long Term data isn’t affected bij the purge_keep_days setting, so if i decrease the purge_keep_days to 4 or 5 days that won’t affect the energy data.

next step is to exclude some entities and find a way to copy the energy data from maria db to influxdb