LabKey Server monitors the queries that it runs against the underlying database. For performance and memory usage reasons, it does not retain every query that has ever run, but it attempts to hold on to the most recently executed queries, the longest-running queries, and the most frequently run queries. In the vast majority of cases, all of the queries of interest are retained and tracked.

This information can be very useful for tracking down performance problems caused by slow-running database queries.

To view the query log:

  • Select Admin > Site > Admin Console.
  • Click Queries in the Diagnostics section.
You can sort the list of queries using the column headers:

Column nameDescription
CountThe number of times that the server has executed the query since it started, or statistics were reset.
TotalThe aggregate time of all of the invocations of the query, in milliseconds.
AvgThe average execution time, in milliseconds.
MaxThe longest execution time for the query, in milliseconds.
LastThe last time that the query was executed.
TracesThe number of different call stacks from the application code that have invoked the query. Clicking the link shows the stack traces, which can be useful for developers to track down the source of the query.
SQLThe query itself. Note that this is the actual text of the query that was passed to the database via the JDBC driver. It may contain substitution syntax.

Clicking on the link in the Traces column will show a details page. It includes the raw text of the query, as well as one example of actual parameter values that were passed. Note that other invocations of the query may have used other parameter values, and that different parameter values can have significant impact on the runtime performance.

From the details page, you can click to get the execution plan of the query as reported by the database itself.


previousnext
 
expand allcollapse all