Troubleshoot Long running sql statements with LONG_RUNNING_SQL view

30 August,2016 by Jack Vamvas

A customer called me yesterday and complained about slow response time on a DB2 database. I asked a few questions and they mentioned a few  ad-hoc queries were executing.  If I’m doing production troubleshooting – running a sql trace is a powerful method to retrieve detailed information.

Prior to getting the detailed information , I’ll use the SYSIBMADM.LONG_RUNNING_SQL view . This is a very useful DB2 administrative view , presenting long – running queries.

Under the hood , the LONG_RUNNING_SQL view joins some system snapshots.

 

 SELECT APPL_NAME,AUTHID,INBOUND_COMM_ADDRESS, STMT_TEXT, AGENT_ID,   ELAPSED_TIME_MIN, APPL_STATUS, DBPARTITIONNUM   FROM SYSIBMADM.LONG_RUNNING_SQL ORDER BY APPL_NAME

 

Check the APPL_STATUS value on the query. Some troubleshooting scenarios which I use are:

a) Finding LOCKWAIT – Use the lock snapshots to dig deeper into the source of the issue

b) Find UOWAIT – check the requesting application

Read More

How to read db2detaileventlock event monitor trace file (DBA DB2)

Database Tuning for complex sql queries (DBA DB2)

Database Tuning – Five Basic Principles according to Shasha (DBA ...

Author: Jack Vamvas(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Troubleshoot Long running sql statements with LONG_RUNNING_SQL view

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright