April 10, 2013 at 3:36 am
If you examine the two plans in the first post of this thread, the first one – for the query with a constant predicate – has been considered for simple parameterization (WHERE [field_value]=@1). Simple parameterization promotes plan re-use – you probably want two separate plans cached for WHERE [field_value] = 'Yes' and WHERE [field_value] = 'No' unless the distribution stats were wildly different. There’s a good chance that SQL Server will use the same plan for both queries.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply