July 16, 2007 at 5:26 am
Hello!
While creating a view and related index, I received the following warning:
Warning: The optimizer cannot use the index because the select list of the view contains a non-aggregate expression.
What does it mean?
Thanks!!!
July 16, 2007 at 5:37 am
It means that you are using functions inside the select statement of the view and the index that youhave created on the view will not be used by the query optimizer to enhance performance.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
July 17, 2007 at 1:52 am
To expand on Sugesh's post,
SELECT SUM(Column1) FROM MyTable would be OK because SUM() is an aggregate expression. SELECT Column1 + Column2 FROM MyTable is not OK because this is an expression but is not an 'aggregate'.
July 17, 2007 at 9:34 am
To further the explantion...
You cannot put indexes on views unless they are specifically designed to be "Indexed Views". There's a long list of requirements to make an Indexed View in Books Online...
So far as normal indexes go, they can and do use the indexes on the underlying tables as would any SELECT.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply