Skip to main content

SQL statistics

This document has been created based on the MySQL Monitoring V2. For the MySQL monitoring V1 document, see the following.

Home > Select Project > STAT/REPORT > SQL Statistics

Statistics are created based on the SQL execution count, execution time, and waiting time within the active sessions collected by the agent, and a list of top SQLs for the search period is provided. It provides a basis for analyzing frequently performed SQL performance through the average and maximum execution time.

For quick performance analysis, you can search top SQLs for each frequently analyzed category (DB, application, user, host). The main search criteria are as follows:

  • execute count: Execution count of the SQL

  • elapse sum (sec): Total execution time (secs) of the SQL

  • elapse avg (sec): Average execution time (sec) of the SQL. It is the result of elapse sum/execute count.

  • elapse max (sec): Maximum execution time (sec) of the SQL

  • elapse wait (sec): Total waiting time (sec) of the SQL

  • instance: Instance name

The SQL statistics function creates statistics based on the SQL that excludes literal values.

Basic screen guide

SQL statistics

  1. In number 1 Time, select the time and date to view the data. You can select a lookup time after selecting the green button.

  2. In number 1 Instance, select a target to view the data. You can select multiple instances. To select all instances, click Select All.

  3. Select Search icon.

The top 50 entries appear in the table.

  • Select the clock display area to query a random date and time. If you click the date and time text area, the selectable options for the date and time appear.

  • If you select each column in the table header, you can sort the list by the selected item.

  • You can sort the searched results by the item selected in lookup criteria. Select a desired item and then select Search icon.

Checking the query-based execution trend

On the utmost left for each item of the table, select number3 ►. A chart appears that displays the number of executions every 5 minutes and the average execution time of the query statement. If you hover your mouse over each bar graph, you can see the number of that time.

If you select a bar graph for the desired time in the graph chart, the Instance Monitoring menu appears. You can see the metrics for the selected time. For more information about instance monitoring, see the following.

To classify and view data by usage category, select the desired tab from number2.

Previewing the query

Query preview

You can preview the query statement by moving the mouse pointer to the sql column in the search results list.

See details

If you select sql from the searched result list, the SQL details window appears.

SQL details

  • View SQL Statistics: You can go to the SQL statistics menu where you can check statistical information related to the SQL query statement.
  • Default Bind: You can bind the part set as a variable in the query sentence to the default value.

  • Reset Bind: You can release the bound default value and check the variable.

  • Formatting: You can improve readability by applying indentation and formatting to a SQL query statement.

  • Plan: To check plan information, enter DB Name, User Name, and Password, and then select Search icon.

  • If you select Vertical split icon on the upper right of the screen, the Query and Plan sections are placed left to right.

  • If you select Vertical split icon on the upper right of the screen, the Query and Plan sections are placed up to down.

Checking the information details

Session Detail

When the bar graph is selected in the chart, the Session detail window appears where you can check statistical data for 5 minutes. The list of SQL executions appears for the selected time. When an item is selected, it goes to the Instance monitoring menu with a new window.

In Instance monitoring, you can check active sessions in the table and trends of various metrics in the selected time zone.