View slow queries
更新时间:
复制 MD 格式
In the AnalyticDB for PostgreSQL console, you can analyze SQL queries executed within a specific time range, view their execution plans, and identify the root causes of slow queries.
Procedure
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
- Find the instance that you want to manage and click the instance ID.
- In the left-side navigation pane, choose .
- Select a time range and click Search.
Slow SQL queries page
| No. | Item | Description |
| ① | Database Name | Enter the name of the database that you want to query. If you leave this field empty, all databases in the instance are queried. |
| ② | Select an execution duration | Select an execution duration:
|
| ③ | Query Time Range | Select a time range. The default is the last hour. Note
|
| ④ | Search | After you specify a Database Name, an Select an execution duration, and a Time Range, click Search to retrieve the query information. |
| ⑤ | Download SQL Queries | Downloads the SQL statements listed in the SQL Query Details section. |
| ⑥ | SQL Query Count Chart | Shows the number of SQL queries executed over the specified time range. |
| ⑦ | SQL Query Details | Displays the details of each query, including a View Execution Plan link, Query ID, Database Name, Start Time, Execution Duration (ms), and the SQL. Note The Query ID and View Execution Plan link appear only for queries that run for more than 1 second. |
Execution plan
You can click the
icon in the View Execution Plan column to view the execution plan details.
The figure below shows the execution plan details.
| No. | Section | Description |
| ① | Basic Query Information | Displays basic information about the current SQL query, including Client IP, User Name, Database Name, Start Time, Execution Duration (ms), Execution Status, and Returned Rows. |
| ② | SQL Statement and Execution Plan |
|
| ③ | Execution Process Statistics | Displays execution statistics for the plan. You can view information for each Segment, including its Execution Status, Execution Start Time, Execution End Time, Execution Duration (ms), Processed Rows, and Memory Consumed (MB). |
该文章对您有帮助吗?