This topic describes the slow query log feature provided by PolarDB-X.
PolarDB-X provides the slow query log feature. You can view the CPU utilization of an instance and the number of slow queries on the instance on the same page. This can help you locate the SQL statements that affect the database performance. On the page for slow query logs, you can view the formatted templates that are used by slow SQL queries and the list of slow queries. You can also view the details of each slow query, such as the number of executions, the execution duration, and the number of rows returned. You can diagnose and optimize slow queries. The slow query log feature provides suggestions on how to create local indexes and global secondary indexes based on the analysis of slow query executions. The feature also provides information about the expected optimization benefits.
The following list describes slow queries that are executed on compute nodes and data nodes.
- A CN slow query is a slow query that the client sends to PolarDB-X and is executed on logical tables.
- A DN slow query is a slow query that PolarDB-X sends to storage nodes at the storage layer and is executed on physical tables. DN slow queries cannot be optimized.
PolarDB-X nodes retain slow query logs for up to 30 days. After the retention period expires, the slow query logs are automatically deleted.
View slow query logs
- Log on to the PolarDB-X console.
- In the top navigation bar, select the region where the instance that you want to manage is deployed.
- On the Instance List page, click the PolarDB-X 2.0 tab.
- On the page that appears, click the ID of the instance.
- In the left-side navigation pane, choose .
- In the Slow Log Trend section, click the Compute Node (CN) and Data Node (DN) tabs to view logs of CN slow queries and DN slow queries.