DB2 optimizing the underlying query for the longest running SQL

Source: Internet
Author: User
Tags db2 switches

Previously wrote a query run to see the longest running app. The query is to the application. Like my program. IIS was found, and it was 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 longest running SQL to use the snapshot.


First, run the following statement 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 run

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

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

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


DB2 optimizing the underlying query for the longest running SQL

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.