I know that you won’t like this (since you seem to have a preference for MSSQL and I am not answering your question), but I will write it
Simplify your life and your OH2 setup by: Using InfluxDB and Grafana
In this way, you can persist everyChange of your Item states and then use Grafana to calculate & display Min/Max/Avg/Total etc. You won’t need all of these extra Items anymore and no more headaches with CRON.
You can also use Groups for persistence to simplify your .persist file. Put the selected items in a new Group called gInfluxDB
and use gInfluxDB* : strategy = everyChange, restoreOnStartup
in your influxdb.persist file.
You can still keep the SQL persistence alive (if needed) and since you know SQL, you will definitely find a way to migrate the existing data into the new DB (maybe using export/import).
The restoreOnStartup speed will increase (InfluxDB vs MSSQL). Although, it is even better to use MapDB for restoreOnStartup and InfluxDB for historical data.