Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    8

    Unanswered: Temporary table Overhead

    Hope somebody can give me some advice .

    We are having some issues with temporary tables (with # prefixes) within Stored Procedures.

    When running a profile trace on them, the stored proc quite happily creates the temp # table (in fact several of them) but whenever it hits the first statement inserting data into one of them (and it doesn't matter which one), there is a 5-6 second delay.

    By commenting out one and moving to the next piece of code, the same thing happens.

    Following which, the rest of the Stored Prco runs fine and subsequent inserts into the # temp tables also run efficiently.

    Is the stored proc getting recompiled perhaps ?

    Any advice woul;d be appreciated.

    we are running SQL Server 7.0, dont know whether that helps ?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Most of the time temp tables are uneccessary and are a sign of remedial SQL writing. Some of the guys on this sight love to rewrite code. Why don't you post the sp in question.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •