DB2 optimized SQL for the longest execution of the underlying query

Source: Internet
Author: User
Tags switches

Before I wrote a query to see the longest running app, the query was that the application, such as my program, found IIS, which is useless.

Select elapsed_time_min,appl_status,agent_id from Sysibmadm.long_running_sql ORDER BY elapsed_time_min DESC FETCH First 5 Rows only

Query the SQL with the longest execution time to use the snapshot.

First, the following statements are executed to turn on the off-first switch:

DB2 UPDATE MONITOR Switches USING lock on
DB2 UPDATE MONITOR switches USING sort on
DB2 UPDATE MONITOR switches USING Bufferpool on
DB2 UPDATE MONITOR switches USING table on
DB2 UPDATE MONITOR Switches USING statement on
DB2 UPDATE MONITOR switches USING UOW on

And then execute

DB2 GET SNAPSHOT for DYNAMIC SQL on Easdb >>d:\dynamicsql.txt

Search in output file: Total execution time (in seconds. milliseconds)

For example I use notepad++, search results, and then find the corresponding SQL to see if you can modify the code, or modify the SQL


DB2 optimized SQL for the longest execution of the underlying query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.