Why so slow DB2 SP

Posted on 2012-08-10
Last Modified: 2012-08-27
Hey I have a simple DB2 SP?   Basically it is just a simple update procedure

It checks if a record exist.

if it exist, depending on content of parameters, construct in a string the update statement

Prepare and Execute it.

Just wondering why is it slow.

Any ideas, suggestions?
Question by:hongning2009
    LVL 37

    Expert Comment

    can you post here the code? (the update statement that is executed, not the code that generates it)
    LVL 18

    Expert Comment

    How long does the update statement take if you run it interactively? (outside of the stored proc)

    How many rows are in the table? Is there an index over the columns in the WHERE clause?

    Have you stepped through the code line-by-line to determine the exact statement that takes the excess time?

    Sorry to bombard you with seemingly "obvious" questions, but you'd be amazad at how often people forget "the basics".

    -- DaveSlash
    LVL 26

    Accepted Solution

    If we can't see the code, it'll just be guesses why it's slow. Please post the code. If code isn't available for posting, you might use google to search for {db2 slow SP} and start trying everything that shows up. I'm not sure any better answer is available.


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
    Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now