Need a way to speed up processing using cursor

  • Yeah, it is there, but still the problem exist.

  • Hi Ranjit,

    There is no simple method to resolve your problem... Try this...

    1. Split you SP Queries into individual blocks

    2. For each block (You can name it as batch) check the query plan

    3. There find out the cost and check whether it is a table scan or index seek

    4. Make sure that if you are not having IO issues. (Learn about RAID and which RAID configuration you need to use when you have for DB which is mostly Read or mostly written)

    5. Run profiler and see Cache hit ratio and SP Compile and increase your SQL Server Accordingly.

    6. Run INDEXDEFRAG or DBREINDEX to avoid Fragmentation.

    7. Consider using Replication and then try to run your reads from the Reporting database.

    .....etc...Follow Ghajini Mohammed path... You will get through..

    Regards,
    Sakthi
    My Blog -> http://www.sqlserverdba.co.cc

  • Oh... Ok. Thanks, I need to learn all these things in detail before applying it. But anyways thanks, i will try and let you know the result.

    Thanks.

  • The problem is solved, removed the loop, now simply used update statements with derived tables for each operation which were earlier used inside cursor. Thanks to all for there suggestions. There are always helpful. Once again thanks

  • Heh... I think we have another set-based convert on our hands. Well done!:D

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 16 through 19 (of 19 total)

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