Hi, I have a question about perf of the following query:
Will the query engine optimize the query by using the detail level filter to avoid unnecessary table join and unnecessary table row access for those detail table columns? If yes, will query engine even not acquire index locks for those unnecessary table? I captured the query plan in SQL Server 2008 and index search operations still existed even detail level did not match. But the query with less details did (~ 30%) faster than the one with full details (data volumn ~ 500,000). Thanks. asked Sep 07 '12 at 10:27 fdxh |
Thought so :) It's another way to write "smart logic": http://use-the-index-luke.com/sql/where-clause/obfuscation/smart-logic
Well, I'm not exactly sure why this happens. Have you tried to compare that against a manually crafted SQL, where you delete all the details you don't need? I'd expect that it is even faster. answered Sep 28 '12 at 16:24 Markus Winand ♦♦ |