Error 701 There is insufficient system memory ...

  • I am curious to know how query analyzer treats a script with regards to Procedure Cache/memory usage/etc... The issue I was running into was the error 701 'There is insufficient system memory'... when executing a sql script that had over 47,000 lines of

    Delete From OBJECTS where ID = '38dkd8dkd8dkf8aks'

    Delete From OBJECTS where ID = '38dkd8drrrrrsdf8aks'

    Delete From OBJECTS where ID = '381234wertdkf8aks'

    Delete From OBJECTS where ID = 'hjuikli8889sdkf8aks'

    Delete From OBJECTS where ID = 'qweasodfijnno8890'

    Delete From OBJECTS where ID = '9073jd7xxklsa7sls7'

    Delete From OBJECTS where ID = 'jxnjos09sksdf9898n'

    ......

    (wasn't my choice, vendor provided).

    I changed the script to use a BULK insert into a temp table and then did my delete. It worked great.

    if OBJECT_ID('tempdb..#BulkImport') is not null DROP TABLE #BulkImport

    CREATE TABLE #BulkImport(

    LineText varchar(100)

    )

    BULK INSERT #BulkImport FROM 'C:\Temp\LIST_FOR_DELETE.txt'

    DELETE FROM OBJECTS WHERE oid in (SELECT LineText FROM #BulkImport)

    DROP TABLE #BulkImport

    How do each of these queries affect memory/performance and why would my method work and the other method errors?

  • See BOL's topic "SQL Server Batch or Task Scheduling".

    The vendor's way made 47,000+ batches in one execution plan. That may have exhausted all of the available worker threads.

    Your method used only one batch.

    If the vendor put GO after every few hundred statements you probably would have been ok.

  • Thanks ksullivan!!! I'll check out BOL's topic "SQL Server Batch or Task Scheduling".

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply