Slow Query Execution

Description: When a specific query runs longer then a specified duration it generates an event. The “Slow Query Execution” Rules contains a list of functions that trigger eventsClosed An event is a collection of runtime-related information collected by the Monitor component. This information is collected when an event is triggered, according to the conditions defined by the Event Rules. either severe or normal.

Information Collected:

The most important details are:

  • URL - As displayed in the Issue’s General Details

  • Request data - Listed in the Request.

In most cases, these details alone should be enough to indicate what happened to trigger an event.

Applicable Diagnostic Actions:

Click on a link to see how to perform each action  tools are listed in order of relevance to helping solve the event:

  • Run the Profiler

  • Open code in editor

  • Run the Debugger

  • View information in the Logs

  • Run general diagnostics on the machine's performance in terms of memory and CPU usage.

  • Use URL Tracing to collect further information about this function in action.

Possible Causes and Solutions:

Slow queries in general indicate that there is a performance problem and they generally appear when there is a heavy load, which in turn causes Web applications to perform poorly.

 

Check the following:

Bottlenecks caused by un-optimized queries or multiple queries, such as un-joined queries, slow queries and multiple short queries. Use the Profiler to see how many queries are running at the same time or set thresholds to find queries that take a long time to run.

Check to see if a different CPU intensive process was running in the background taking up the CPU and making everything run slowly.

Look at the amount of calls to the function - are there too many? add breakpoints and run again to manually trace per query what happened. Possible Solution: cache the information using a Data Cache API as a PHP array or use the Page Cache to cache the presentation layer.

Profiler results - analyze the profiler results and isolate functions/areas that consume the majority of the time and analyze each function/area code separately to isolate the possible cause of the problem.