Updated on 2022-04-28 GMT+08:00

SQL Analysis

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. SQL analysis supports MySQL, Oracle, and PostgreSQL relational databases only.

SQL Page

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 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 analyze and optimize them.

The SQL analysis function determines whether to collect SQL data. Before performing the following operations, 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 then enable it.

  1. Log in to the APM console.
  2. In the navigation pane, choose SQL Analysis.
  3. On the SQL Analysis page, select the time range during which a problem occurred.
  4. On the Overview tab page, locate the faulty database in the application based on key metrics. If a database requires long response time and has many call errors, performance problems may occur.

  5. Analyze the problem cause.

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

  6. 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.