In PolarDB-X 1.0, SQL statements that are executed for more than 1 second are defined as slow SQL queries. Slow SQL queries consist of logical and physical slow SQL queries. This topic describes the definitions and query methods of the two types of slow SQL queries.

Definitions of slow SQL queries

  • Logical slow SQL queries: slow SQL queries that are sent from a client to PolarDB-X 1.0. The slow queries queried in the PolarDB-X 1.0 console are all logical slow SQL queries.
  • Physical slow SQL queries: slow SQL queries that are sent from PolarDB-X 1.0 to the storage layer MySQL. All the slow SQL queries queried at the storage layer MySQL are physical slow SQL statements.

Precautions

Each PolarDB-X 1.0 node stores the details about a maximum of 5,000 slow SQL queries. The details about extra slow SQL queries are deleted in a rolling way.

Procedure

  1. Log on to the PolarDB for Xscale console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. In the left-side navigation pane, click Instances.
  4. Find the target instance and click the instance ID to go to the Basic Information page.
  5. In the left-side navigation pane, click Slow SQL Queries.
  6. Specify Select Time Range, Database Name, and Execution Time, and then click Search to view the information about slow SQL queries.
    Query logical slow SQL queries
  7. You can also view the information about the corresponding physical slow SQL queries at the storage layer MySQL by performing the following steps:
    Note Only physical slow SQL queries in PolarDB for MySQL that serves as the storage layer can be queried.
    1. In the left-side navigation pane, click Databases. Select the required database.
    2. Click Storage Management and click the required cluster. The Overview page of MySQL at the storage layer appears.
    3. In the left-side navigation pane, click Slow SQL Query.
    4. To query Slow Log Trend, Slow Log Statistics, and Slow Log Details within a specified time range, specify time in the upper-right corner and click Search.
    5. Click Slow Log Details and select the required database and the primary node to view details about slow query logs
      View physical slow query logs
      Note For more information about slow SQL analysis and diagnostics features, see Slow SQL query.