There is a table of initial data with the following column structure (N-number of the measurement from the beginning of the year + 300 columns of the results of measurement).
For it in the future, it is required to repeatedly receive statistical data for a certain interval of measurements. For example, to determine how much for the interval from 10 to 472 measurements for each of the data columns were unique values, average, maximum minimum value, etc.
To optimize the acquisition (in order not to calculate the values each time), a КэшСтатистики
table was КэшСтатистики
with the columns КэшСтатистики
+ Статистические_данные
out of range.
When receiving data from 10 to 472 measurements, they are immediately taken from the КэшСтатистики
table, and if you need values, for example, from 8 to 478, you can measure them directly from the source data table, or take the calculated results from the КэшСтатистики
for the range 10..472 and aggregate with the remaining Measurements 8, 9, 473..478.
The question is how to build a query that would give the maximum combination of calculated intervals for a given range of measurements from the КэшСтатистики
table КэшСтатистики
order to less calculate the source data