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