The aggregate functions MIN
,MAX
,AVG
, and STDEV
are not allowed in an Indexed View in SQL Server (Create Indexed Views - MSDN Library).
Does SQL Server have a mechanism to index the results of the following view, even though INSERT
, UPDATE
, and DELETE
operations would become much more expensive?
SELECT
test.test_id,
MIN(samp.result) AS tMin,
MAX(samp.result) AS tMax,
AVG(samp.result) AS tAvg,
STDEV(samp.result) AS tStdev
FROM test
INNER JOIN samp ON test.test_id = samp.test_id
WHERE samp.status = 'OK'
GROUP BY test.test_id