BorderLayoutBoxedLayoutOpenLayoutMaximum textMedium textSmall text


Register
Friday, July 03, 2009
MyStreamMinimize
Print  

RE: Filtered indexes not compatible plan reuse

Posted by Jason on Friday, March 21, 2008 to SQL Server 2008, query optimizer, Indexes, CTP6, Procedure Cache
1081 Views | 1 Comments | Article Rating

Before the original post, I had submitted a connect item for something similar.

It turns out that filtered indexes may not be used when auto-parameterization(or for stored proc) occurs without a recompile hint. This is sort of understandable but I can think of workarounds and I suspect additional logic will be added in the future as mentioned below. Here is the feedback from a connect item I submitted.

"

Thanks for your feedback. The query in question, select lastname from Person.Contact where ContactID <=(100-20) is auto-parameterized by SQL Server into the following form, using the standard auto-parameterization rules: select lastname from Person.Contact where ContactID <=(@1-@2) These rules are designed to minimize compile time cost for simple queries like this, possibly at the expense of additional optimizations such as using a filtered index. Admittedly, it is a difficult tradeoff. In a future release, we'll consider extending the design to make a better decision in a cost-based way. For now, this behavior is by design.

"

alt head: You can't have your cake and eat it too.

email it! |   |   |   |  | 
Permalink     1 Comments  

Rate this Post:
COMMENTS:

posted @ Friday, March 21, 2008 11:56 PM by DotNetKicks.com


Name (required)

Email (required)

Website


Simple BBCode can be used like [url=http://example.com]Example[/url] and [B]

Copyright 2006 by Statistics IO, My SQL Server Blog