MS SQL 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:27 UTC
Read the original article Hit count: 197

Filed under:
|
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

Related posts about mssql-2005

Related posts about debugging