Related pages:

The Queries window displays the SQL statements and stored procedures that consume the most time in the database. You can compare the query weights to other metrics such as SQL wait times to determine SQL that requires tuning. 

Access the Database Queries Window

To access the Database Queries window:

  1. To view database queries, click the name of the database.
  2. Click the Queries tab.

Database Queries Window Features

Database agent reports all the queries with execution time > 1 second. It captures queries with execution time <= 1 second only if the query is executed at the sampling time.


From the Database Queries window, you can:

From the Database Queries window, you can view:

For SQL Server, Azure, Oracle, PostgreSQL, SAP HANA, and DB2 the metrics Number of Executions, Average Response TIme and Elapsed Time are inferred from the query index. When you are viewing the queries with Group Similar checked, the statistics reflect only the queries that have captured query statistics. Queries that do not have query statistics are excluded from the statistic values.

For databases such as MySQL and MongoDB which do not have a query index, no data will appear in the Number of Executions and Average Response Time columns. However, Elapsed Time can be inferred for MySQL and MongoDB databases using the wait state index. Elapsed Time can also be inferred using the wait state index when query statistics for a query run on an SQL Server, Azure, Oracle, PostgreSQL, SAP HANA or DB2 database are otherwise not available. When query statistics are not available for a query run on an SQL Server, Azure, Oracle, PostgreSQL, SAP HANA or DB2 database, the Number of Executions and Average Response Time statistics cannot be reported and are marked with a hyphen (-). This means that the database did not provide statistics for this query in the selected time range.

Once you have identified the statements that are consuming the most resources, you can dig down deeper for details that can help you tune the SQL statement. For in-depth query details, click a SQL statement and then click View Query Details. See Database Query Details Window.