Updated on 2022-02-21 GMT+08:00

SQL Analysis

Application Performance Management (APM) displays key metrics, such as SQL statement calls, response time, and errors for analyzing database performance problems caused by slow or error SQL statements. Currently, SQL analysis supports MySQL, Oracle, and PostgreSQL relational databases only.

SQL Page Description

Figure 1 SQL page

Analyzing Abnormal SQL Statements

When an SQL statement of a database is abnormal, performance problems such as service timeout may occur. During routine O&M, you can monitor key metrics (such as the error duration and latency) of databases, locate the SQL statements that take a long time to execute, operate at low efficiency, or fail to be called, and then make analysis and optimization accordingly.

The SQL analysis function determines whether to collect SQL data. Before performing the following steps, ensure that this function is enabled. Otherwise, no SQL data can be queried. This function is enabled by default. If it is disabled, choose Agent > Configuration in the navigation pane and enable it.

  1. On the SQL Analysis page, set the time range during which a problem occurred in the upper right corner.
  2. On the Overview tab page, locate the faulty database in the application based on key metrics. If a database has long latency and many call errors, a performance problem may occur.
  3. Analyze the performance problem.

    Click the SQL Analysis tab, and locate the abnormal SQL statement.

  4. Further analyze the cause.

    1. Click the abnormal SQL statement to go to the Call Chain page and check the impact of this statement on the entire service.
    2. Click View Call Relationship in the Operation column to find out the method of the abnormal SQL statement. Analyze the cause of the abnormal SQL statement in this method. For example, check whether the index is used, data volume is overlarge, syntax is correct, or deadlock occurs. Then, optimize the SQL statement accordingly.