Hologres V0.10 and later allow you to query and analyze slow query logs to diagnose and analyze slow queries or failed queries, and take optimization measures for such queries. This topic describes how to query and analyze slow query logs in the Hologres console.
Limits
The slow query log query and analysis feature is supported only in Hologres V0.10 and later. You can view the version of your Hologres instance on the instance details page in the Hologres console. If the version of your instance is earlier than V0.10, manually upgrade your Hologres instance in the Hologres console or join a DingTalk group to apply for an instance upgrade. For more information about how to manually upgrade a Hologres instance, see Instance upgrades. For more information about how to join a DingTalk group, see Obtain online support for Hologres.
Up to 2,000 slow query logs can be returned for each query request to ensure system stability and prevent traffic overloads.
HoloWeb allows you to query slow query logs within seven days.
Query slow query logs
Log on to the Hologres console. In the left-side navigation pane, click Go to HoloWeb to go to the HoloWeb page. In the top navigation bar, click Diagnostics and Optimization.
In the left-side navigation pane, click Historical Slow Query.
On the Historical Slow Query page, set the parameters that are described in the following table.
Parameter
Required
Description
Instance
Yes
The name of the instance whose slow query logs you want to query. By default, the connected instance is selected.
Database
No
The name of the database whose slow query logs you want to query. You can query slow query logs of the specified database only if you have the required permissions on the database. Otherwise, you can query slow query logs only within your Alibaba Cloud account.
Table
No
The name of the table whose slow query logs you want to query. You can query slow query logs of the specified table only if you have the required permissions on the table. Otherwise, you can query slow query logs only within your Alibaba Cloud account.
User
No
The Alibaba Cloud account within which you want to query slow query logs.
List Limit
Yes
The number of slow query logs to return. Up to 2,000 slow query logs can be returned for each query request.
Running
No
The execution duration of the query. By default, Hologres collects the logs of the queries that take more than 1 second.
Metrics
No
The dimension from which the query trend is displayed. Valid values: Slow Query and Failed Query.
Query
No
The SQL statement executed in the query. You can use a percent sign (%) in the SQL statement to represent all table names.
Type
No
The type of the SQL statement executed in the query. Statement types such as DDL and DML are supported.
Query ID
No
The ID of the query.
Time
Yes
The time range to query. Default value: 10 Minutes. The maximum time range in which slow query logs can be queried is seven days.
After the parameters are set, click Query to view the trend analysis and details of slow queries and failed queries. For more information, see the View the trend analysis and details of slow queries and failed queries section of this topic.
View the trend analysis and details of slow queries and failed queries
Query Trend Analysis
View the trend of slow queries and failed queries before and after a specific point in time.
Click a specific point in time in the trend chart to view the trend of slow queries and failed queries within 10 seconds before and after the point in time.
View the trend of slow queries and failed queries within a time range.
Select a time range in the trend chart to view the trend of slow queries and failed queries within the selected time range.
Queries
View the slow query logs that meet the filter conditions.
The following table describes the default parameters.
Parameter
Description
Query ID
The ID of the query.
Database
The name of the database whose slow query logs you want to query.
User Name
The username that is used to execute the SQL statement in the query.
Type
The type of the SQL statement executed in the query.
Duration
The total execution duration of the query, including the optimization duration, the startup duration of the query, and the duration for returning the query result.
Start Time
The start time of the query.
Status
The status of the query.
Query
The SQL statement executed in the query. You can click the SQL statement to view its details.
Engine Type
The type of the query engine that is used to process the current SQL query.
Query Plan
The execution plan of the query.
Operation
Details: Click Details to go to the details page of the query. You can view the details of the query on this page. The details can help you optimize the SQL statement.
: Click the icon to open a new SQL editor for the query.
View other parameters.
If the default parameters do not meet your requirements, click Customize Columns in the upper-right corner of the Queries section. In the dialog box that appears, select more parameters to display.
View the Gantt chart.
HoloWeb supports Gantt charts. To view the Gantt chart of queries, you can click View Gantt Chart in the upper-right corner of the Queries section. In the dialog box that appears, you can view the execution status of queries that are concurrently executed within a specified time range. This helps you identify performance bottlenecks when queries are concurrently executed.