• My impression is that your query is too complicated and the query optimizer has no chance of compiling the most efficient plan. You can see this in the execution plan you posted.

    StatementOptmEarlyAbortReason="TimeOut"

    This means that the optimizer timed out while evaluating plans and occurs in both of your queries.

    You mention that you want to know the difference between

    Select from myView where fldValue IN (123,456,789)

    and

    Select from myView V inner join myTemp T ON V.fldValue = T.fldValue

    However your queries are so complicated it is preventing you from comparing an apple with an apple.

    If I were you I wouldn't be at all interested in the above comparison, but rather in breaking up the query to give the optimizer a better chance.

    Most alarming to me is MemoryGrant="25184" for query 1 and MemoryGrant="529712" for query 2.

    http://blogs.msdn.com/b/sqlqueryprocessing/archive/2010/02/16/understanding-sql-server-memory-grant.aspx

    Query 1 has 9 hash matches while query 2 has 14 hash matches.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]