cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Alert single database SQL takes more than certain threshold

We have a scenario that particular web transaction in the application caused table deadlock in which it takes down the database server. Application team wants to know what transaction that caused deadlock. The problem is purepath got timeout after 10 mins and we don’t whether we got that purepath or not.

So we are trying to monitor any SQL query which takes more than 5 mins and notify if hits that threshold. I’m not sure whether it can be done at the SQL query level to capture execution of single query instead of whole transaction? Any idea on this? if you anyone experienced similar problem, how do you handle this scenario ?

Ex: Purepath 1 has 1000 SQL queries and out of which 980 queries took less than 4 mins and 20 queries took greater 5 mins. We interested only 20 queries to monitor and capture it.

1 REPLY 1

andreas_grabner
Dynatrace Leader
Dynatrace Leader

Hi

For Oracle Databases we have a great plugin that tells you the slowest SQL Statements independant of the PurePath: Oracle Monitor Plugin

For other databases - or - if you want to have a generic approach - you need to make sure that these SQL Statements are on the PurePath. Is it normal that your PurePaths take that long? If so - you can increate the timeout limit. You should however ONLY do this if this behavior is normal and PurePaths can really take that long. If you search for PurePath timeout limit you find the right settings to change this limit. If that is not normal i would first start with looking at these timed out purepaths and figure out how to make these TXs faster. If you e.g: have PPs with 1000 SQLs I wonder if this is necessary or not

Once you have that SQL Statement on the PurePath you can create a Business Transaction that filters those PPs where you have Dataase Exec Times > 10m. To create such a BT the easiest is to

a) open the DB Dashlet

b) right click on a SQL Statement

c) Select "Create Business Transaction"

d) In the upcoming Measure Dialog make sure you select the Database -> Time Measure type from the left tree

e) Remove the SQL Statement text itself so that this measure will capture all SQL Executions.

f) Give the measure a good name, set the upper severe threshold to 10000ms and then click on Filter

That should do the trick