Skip to main content

Mysql SQL Statistics

Home > Select Project > Stat/Report > MYSQL SQL Statistics

SQL statistical data (execution count, execution time, number of rows, etc.) provided by MySQL's performance_schema is collected through the performance_schema.events_statements_summary_by_digest view.

Note
  • This function is supported in DBX agent 1.6.10 or later.

  • For more information about the events_statements_summary_by_digest view, see the following link.

Before use

To use MYSQL SQL Statistics, the following settings are required in the target monitoring DB.

  1. Enable Performance Schema in the database configuration (my.cnf).

    my.cnf
    performance_schema = on
  2. Set the view role to allow the monitoring account to read the data.

    grant select on performance_schema.* to whatap;
  3. Set the options in the DBX agent.

    whatap.conf
    statements=true
Note

Delta values are calculated and collected from events_statements_summary_by_digest at 1-hour intervals. Therefore, collection begins one hour after configuration.

Basic screen guide

MYSQL SQL Statistics

  1. Select the time and date to view data in Time. You can also select a lookup time by clicking the green button.

  2. Select a target to view data in Instance. You can select multiple instances. To select all instances, click Select all.

  3. Select Search icon.

The top 50 entries appear in the table.

Note
  • Select the clock display area to query a random date and time. If you click the text range for date and time, the option appears to select the date and time.

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

  • You can sort the searched results according to the items selected in Sort by. Select a desired item and then select .

  • In View count, you can set the number of items to display in the table. After all settings are finished, select .

  • To download the viewed data as a CSV file, select Download icon.

  • If you select query from the searched result list, the SQL details window appears. For more information, see the following.

Column information guide

Field nameDescription
digest_textSQL statement
digestHash value of digest_text
schema_nameSchema name
count_starExecution count
timer_waitTotal execution time (sec)
lock_timeWaited time caused by table lock (sec)
rows_affectedNumber of affected rows (insert, update, replace)
rows_sentNumber of returned rows
rows_examinedNumber of rows reviewed in the server layer
created_tmp_disk_tablesIf the sum of disk temporary tables created by the server while executing commands is too high, consider increasing the sort memory size.
created_tmp_tablesSum of internal temporary tables created by the server while executing commands.
select_full_joinNumber of table scans without using indexes. If it is not 0, index checking is required.
select_full_range_joinNumber of joins using the range search on reference tables
select_rangeNumber of joins using the range in the first table
select_range_checkNumber of joins with no key. If it is not 0, checking is required.
select_scanNumber of full scans to the driving table
sort_merge_passesCount sorted by sort merge
sort_rangeCount sorted by range
sort_rowsNumber of sorted rows
sort_scanCount sorted by scan
no_index_usedNumber of queries without using any index. Indexing is required.
no_good_index_usedNumber of times that no index is found for use among the indexes on the server. If the count increases, index checking is required.

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 query details

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.

    • Text: You can check plan information in text format.

    • JSON: By viewing the plan information in Json format, you can quickly find the points where bottlenecks occur.

    Note

    The function to view plan information in JSON format is supported only in DBX agent 1.6.12 or later.

Filtering the searched results

Adding the filter conditions

You can perform a search by filtering by SQL text, agent name, DB user name, and the like.

Adding conditions

  1. In the Filter option, select .

  2. In Filter key, select a desired filtering criteria.

    • If the value of the selected item is text, you can select any of Includes (blue) and Excludes (red).

      Condition color

    • If the value of the selected item is number, you can select any condition of == (equal to), >= (greater than or equal to), and <= (less than or equal to).

  3. In Condition, select a condition.

  4. Enter a string or number to match the condition.

  5. Select Apply.

Note
  • To add filtering conditions, select Add and then repeat Step 1 to 5. Added conditions are applied based on AND (&&).

  • To delete some items while adding conditions, select Delete icon on the right of the filter conditions. To delete all conditions, select Delete icon Delete All.

  • To quickly delete the conditions applied to the Filter option, select .

  • The default setting is to exclude if sqlText contains 'WhaTap'.

    WhaTap

Modifying the filter conditions

Edit filter

Click any applied to the Filter option. If the Edit filter window appears, modify any desired items and then select Apply.

Configuring the table columns

You can hide the table header columns or add any of them. You can also change the column order. Select Column icon.

Column Settings

Note
  • After configuration, select OK to apply the settings in the table.

  • In the number 3 search bar, enter text to search the desired columns. Only the columns that meet the entered text are displayed.

Adding columns

From the Number 1 list, select the items to add as table header columns. To select all items, select Select All.

Deleting columns

From the number 1 list, unselect the columns to delete. Alternatively, select Delete icon on the right of the item to delete from the number 2 list.

Changing the column order

Drag an item to reposition from the number 2 list, and then move it to the desired position.

Initializing the configuration

To cancel all changes and reset them, select Reset icon Reset.