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 historical slow query logs in a visualized manner in Hologres.
Limits
This feature is supported only by 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 Hologres instance is earlier than V0.10, manually upgrade your Hologres instance in the Hologres console or join a Hologres 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 Hologres 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. In the top navigation bar of the HoloWeb console, click Diagnostics and Optimization.
In the left-side navigation pane, click Historical Slow Queries.
On the Historical Slow Query page, configure the parameters that are described in the following table.
Parameter
Required
Description
Instance Name
Yes
The name of the instance whose slow queries you want to query. By default, the connected instance is selected.
Database
No
The name of the database whose slow queries 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 Name
No
The name of the table for which you want to query slow query logs. 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.
Queried Rows
Yes
The number of slow query logs to return. A maximum of 2,000 slow query logs can be returned each time.
Duration
No
The execution duration of the query. By default, Hologres collects the logs of queries that consume 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 statement executed in the query. You can use the percent sign (%) in the 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.
Virtual Warehouse
Yes
The computing resources of the query.
Time Range
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 configuration is complete, click Query to view information in the Query Trend Analysis and Queries sections. For more information, see the View the trend analysis and details of slow queries and failed queries section in 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 fields that are selected by default.
Parameter
Description
Query ID
The ID of the query.
Database
The name of the database for which data was queried.
User Name
The name of the user who executes the SQL statement.
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.
Actions
Details: Click it 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 it to open a new SQL editor for the query.
: Click it to go to the Query Insight page.
View other fields.
If the default fields do not meet your requirements, you can select parameters based on your business requirements by clicking 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.