Allow specific purging action for `short_term_statistics`

Hello everybody and a special hello to the devs working on the database and recorder,

I would like to request a modification to the current purge action and the matching recorder configuration.

At the moment, purging deletes all entries from states and from short_term_statistics. The latter in reality is not really lost because it is downsampled to long term statistics.
However, once you delelte the states entries, you forever lose the details of you measurements.

I just performed manual “cleaning” of my database and found that the short_term_statistics, if purge is disabled, take up more or less the same amount of space as the states data (in my case one had ~3.3E+8 entries and the other ~2.5E+8 entries). As statistics only has around 1/10 of that, keeping statisticsmakes sense but keeping short_term_statistics does not. You might as well keep the original data in states.

All three tables have their validity. Each serving a specific purpose. But for people who want to keep their original data, being able to purge specifically only short_term_statistics would significantly reduce the database size without impacting the quality of data or the long term evaluation capabilities.

So, I would like to request adding a purge short_term_statistics action and the matching modification of the recorder integration.

Thank you for your consideration.

Alex

I agree this would be super helpful.