Semi Join - performance issue

Answered Semi Join - performance issue

  • Friday, February 01, 2013 8:22 AM
     
     
    I have a strange performance issue trying to upgrade our SQL 2005 to SQL2012.

    TableA in on a database running SQL2012
    Remoteserver is a 2005 server

    When  I run the following query my current production server (TableA is on SQL2005 in production), the performance is great:

    select *  from TableA where CustID not in (select CustID from remoteserver.PRDA.dbo.Cust)

    But when I run the same query on my SQL2012, I get a left anti semi join and the query run for a very long time.  How can I get ride of the Left Anti Semi Join?

    If I save the result of the query from the remote server in a temp table, and use the temp table it works well.

    select CustID into #tempCust from remoteserver.PRDA.dbo.Cust
    select *  from TableA where CustID not in (select CustID from #tempCust).

All Replies