SQL Server 2005: Why would a delete from a temp table hang forever?
        Posted  
        
            by Dr. Zim
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Dr. Zim
        
        
        
        Published on 2010-03-12T16:26:16Z
        Indexed on 
            2010/03/12
            16:57 UTC
        
        
        Read the original article
        Hit count: 215
        
sql-server-2005
|debugging
DELETE FROM #tItem_ID
WHERE #tItem_ID.Item_ID NOT IN (SELECT DISTINCT Item_ID
                                  FROM Item_Keyword 
                                  JOIN Keyword ON Item_Keyword.Keyword_ID = Keyword.Record_ID
                                 WHERE Keyword LIKE @tmpKW)
The Keyword is %macaroni%. Both temp tables are 3300 items long. The inner select executes in under a second. All strings are nvarchar(249). All IDs are int.
Any ideas? I executed it (it's in a stored proc) for over 12 minutes without it finishing.
© Stack Overflow or respective owner