Maybe a good reason to look at InfluxDB and Grafana.
You can set retention policies to keep your database from growing past a specified point, as well
as downsample the long term data. (Paul Reed does that, see this thread: Grafana Dashboard Project)
Grafana has the ability to display data smoothed via a moving average.
In fact, you can actually do a fair amount of math right in Grafana.
Food for thought…