Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003

    Unanswered: Cursor out of time


    First of all sorry about poor english.
    I have the next problem:
    I have a store procedure which declares a cursor which is a select from some tables. Im surprised because the sp takes over 10 seconds on working and if i execute the select of the cursor as separate ways, it takes no more one second. Ive changed the select with another easier select and it works 0 seconds, so it seems that the problem is in the select, but only if i use a cursor to save the regs, why????????

    Thanks a lot.

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Use the "show execution plan" option to see how the server is executing the three queries. Check to see what it different between them. My guess is that there is something causing the optimizer to make a radically different choice for one or more of the queries, and that is what is making them take longer.


  3. #3
    Join Date
    Apr 2004
    Kansas City, MO
    Just don't use cursors. What are you trying to do with the cursor?
    When life gives you a lemon, fire the DBA.

  4. #4
    Join Date
    Oct 2003
    Thank you for answer.
    I think that I meant wrong.
    If I execute the select in the cursor it takes me over ten seconds but if I copy the select and paste in the query analyzer, it takes me 0 seconds. Besides this, if i change the select by other easier one, the cursor takes 0 seconds. I know the first select could be wrong but it works 0 seconds in the analyzer!!!! and inside the cursor there is not any operations.

    Thanks a lot....

Posting Permissions

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