Updated on 2023-03-28 GMT+08:00

SQL Explorer

Use Constraints

SQL Explorer cannot record all data. As for RDS for PostgreSQL, it has the following constraints:

SQL Explorer is limited by the memory buffer, so some data may not be recorded when a buffer overrun occurs, for example, when the QPS is over 1000 or the usage of resources such as CPUs or memory becomes too high.

Any SQL statement that exceeds 4096 bytes by default will be discarded.

SQL Explorer is available to only RDS for PostgreSQL instances of the following versions:

  • Major version: 14; minor version: 14.4 or later
  • Major version: 13; minor version: 13.6 or later (if the minor version is 13.2 or later but earlier than 13.6, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)
  • Major version: 12; minor version: 12.10 or later (if the minor version is 12.6 or later but earlier than 12.10, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)
  • Major version: 11; minor version: 11.15 or later (if the minor version is 11.11 or later but earlier than 11.15, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)
  • Major version: 10; minor version: 10.20 or later (if the minor version is 10.16 or later but earlier than 10.20, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)
  • Major version: 9.6; minor version: 9.6.24 or later (if the minor version is 9.6.21 or later but earlier than 9.6.24, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)
  • Major version: 9.5; minor version: 9.6.25 or later (For some instances with the minor version of 9.5.25, SQL statements executed using psql can be collected, but those executed by other drivers like JDBC may not.)

Procedure

  1. Log in to the DAS console.
  2. On the Overview page, click Go to Intelligent O&M.
  3. Select the required instance and click Details.
  4. Choose SQL > SQL Explorer to view SQL Explorer details of the instance.
  5. Toggle on Enable DAS SQL Explorer to obtain information about all SQL statements executed on the current instance.

    You can click Export in the upper right corner of the SQL template list to obtain information about all SQL templates in the list. This feature is available to only paid instances.

  6. Click the TOP SQL tab and select Last 1 hour, Last 3 hours, or Last 6 hours to view the top SQL statements executed. You can also customize a time range with the duration no longer than one day.

    Execution Duration Distribution displays the distribution of the time required to execute all SQL templates in a specific period of time. There are four execution duration ranges. The system calculates execution times of the SQL statements in each execution time range. If you select Last 1 hour, the execution duration distribution is updated every 10 seconds. If you select Last 6 hours, the distribution is updated every 1 minute. If you select a time range longer than 6 hours, the distribution is updated every 5 minutes. The execution duration ranges of SQL templates are as follows:

    • < 100 ms
    • 100 ms—500 ms
    • 500 ms—1s
    • > 1s

  7. Select By instance or By node. If you select By node, you can view execution duration distribution of the primary node. You can change node to view the duration distribution of other nodes. The primary node is selected by default.
  8. View execution duration details of top SQL templates with the following methods, such as average execution duration, total duration, average lock wait duration, and average scanned rows.

    • Hover your mouse at any point in time on the graph to view top SQL templates at that time.
    • Specify a time range using your mouse on the graph, and you will see top SQL templates used during that time range.

  9. In the SQL template list, locate a SQL template and click Details to view total executions, average rows scanned, average execution duration, and the like.