In Hologres V0.10 and later, you can query and analyze slow query logs to diagnose, analyze, and take optimization measures for slow queries or failed queries. This topic describes how to query and analyze slow query logs in a visualized manner.

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 instance is earlier than V0.10, submit a ticket to update your instance.
  • To ensure system stability and prevent traffic overloads, a maximum of 2,000 slow query logs can be returned each time.
  • The maximum time range in which slow query logs can be queried in the HoloWeb console is seven days.

Query slow query logs

  1. Log on to the HoloWeb console. In the top navigation bar, click Diagnostics and Optimization.
  2. In the left-side navigation pane, click Historical Slow Query.
  3. On the Historical Slow Query page, set the parameters that are described in the following table.
    Filter conditions
    Parameter Description Limit
    Instance The name of the instance whose slow query logs you want to query. By default, the connected instance is selected. N/A
    Database The name of the database whose slow query logs you want to query. You can query slow query logs of the specified database, table, or Alibaba Cloud account provided that you have the required permissions. Otherwise, you can query slow query logs only within your Alibaba Cloud account. For more information, see Query and analyze slow query logs.
    Table The name of the table whose slow query logs you want to query.
    User The Alibaba Cloud account within which you want to query slow query logs.
    List Limit The number of slow query logs to be returned. A maximum of 2,000 slow query logs can be returned each time.
    Running The execution duration of the query. By default, Hologres collects the logs of queries that consume more than 1 second.
    Metrics The dimension from which the query trend is displayed. Valid values: Slow Query and Failed Query. N/A
    Query The statement used in the query. You can use the percent sign (%) in the statement to represent all table names. N/A
    Type The type of the statement used in the query. The statement types in categories such as DDL and DML are supported. N/A
    PID The process ID (PID) of the query. N/A
    Time The time range to query. The maximum time range in which slow query logs can be queried is seven days.
  4. After the parameters are set, click Query to view the trend of slow queries or failed queries and the slow query logs that meet the filter conditions. For more information, see View the trend of slow queries or failed queries and the slow query logs that meet the filter conditions.

View the trend of slow queries or failed queries and the slow query logs that meet the filter conditions

  • Trend of slow queries or failed queries
    • View the trend of slow queries or 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 or failed queries within 10 seconds before and after the point in time.

    • View the trend of slow queries or failed queries within a time range.

      Select a time range in the trend chart to view the trend of slow queries or failed queries within the selected time range.

  • Slow query logs that meet the filter conditions
    • View the slow query logs that meet the filter conditions.

      The following table describes the default fields.

      Field Description
      ID The ID of the Alibaba Cloud account used to execute the SQL statement.
      Database The name of the database whose data is queried.
      Type The type of the SQL statement used in the query.
      Query The statement used in the query. You can click the statement to view the details of the statement.
      Status The status of the query. Valid values: Succeeded and Failed.
      Start Time The start time of the query.
      Duration The total execution duration of the query, including the optimization duration, and the startup duration of the query, and the duration for returning the query result.
      Read Bytes The number of bytes read by the query.
      Operation By default, Details is displayed.
      • Click Details to go to the details page of the query. Then, you can view the details of the query, including the basic information, such as the database whose data is queried and the PID of the query, advanced information, total execution duration, and startup duration. You can also optimize the SQL statement. For more information, see Optimize the performance of querying internal tables.
      • Click the Icon icon to the right of Details to open a new SQL editor for the query.
    • View other fields.

      If the default fields cannot meet your requirements, click Customize Columns in the upper-right corner of the Queries section. In the Select Columns to Display dialog box, select more fields to display.

      Customize Columns