• Hugo Kornelis (2/13/2012)


    Revenant (2/13/2012)


    All exactly as I expected. This confirms that on editions below Enterprise, the only way to get the optimizer to use an index on the view is to use the NOEXPAND hint; using an index hint will not work, as they are ignored on views.

    Remember, on Enterprise Edition (and hence also on the feature-equal Developer Edition and on DataCenter, which is essentially Enterprise++), the optimizer will automatically consider using indexes on views, regardless of whether the query references the view or the base tables. On lower editions (such as Standard, Workgroup, and Express), the optimizer will never consider using indexes on views, unless the NOEXPAND hint is used to force the use of an index on the view.

    I have attached the execution plan of the 5 queries plus an additional query using the NOEXPAND hint. The warning message was not reported with the execution of this query.