sql server - Why can't indexed views have a MAX() aggregate? -


I am trying to get some index ideas and impress, but I almost always need maximum or a minute and Can not understand why this is not working with them, can anyone explain why?

I know that they are not allowed, I do not understand why !!! Calculation etc. Why are not MIN / MAX, I am looking for explanation ...

< P> This set is not allowed because they can not be solely based on changed values.

Certain aggregates, such as COUNT_BIG () or SUM () , should be changed again, looking at the data that has changed. This is allowed in a indexed view because, if an underlying value changes, then the effect of that change can be directly calculated

other aggregates such as MIN () And MAX () , can not be recomputed simply by viewing the data which is being changed. If you remove the value that is currently maximal or minimum, new maximum or minimum searches should be performed and the entire table will be found in.

The same principle applies to another set, like avg () or standard variation set. SQL can not just reconstruct them from those values, but to get the new value, the whole table needs to be scanned again.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -