Updated on 2024-12-24 GMT+08:00

ClickHouse Slow Query Management

The Slow SQL page contains two tab pages: Ongoing Slow Queries and Completed Slow Queries. By default, SQL statements whose latency exceeds 500 millisecond in the cluster are displayed. You can manually determine whether to click Kill Query to end an ongoing SQL statement.

Querying Ongoing Slow SQL Statements

  1. Log in to the CloudTable console.
  2. Click the name of the target cluster to access its details page.
  3. In the navigation pane on the left, choose Slow Query Management.
  4. Use filter criteria such as the latency, time range, user, remote IP, and SQL statement to quickly find out or kill the desired slow queries.

    Table 1 Ongoing slow query parameters

    Parameter

    Description

    Query ID

    ID of each SQL command

    Start time

    Time when the SQL statement starts to be executed

    End time

    Time when the SQL statement execution ends

    Database

    Database that is being queried

    SQL Statement

    Ongoing SQL statement

    Latency (ms)

    SQL execution duration

    Status

    SQL status

    User

    User who submitted the SQL statement.

    Remote IP

    Address of the client used by the user who submitted the SQL statement.

    Operation

    Operation for killing the query

Querying Completed Slow SQL Statements

  1. Log in to the CloudTable console.
  2. Click the name of the target cluster to access its details page.
  3. In the navigation pane on the left, choose Slow Query Management and click Completed Queries.
  4. Use filter criteria such as the latency, time range, status, user, remote IP, and SQL statement to quickly find out the desired slow queries.

    Table 2 Completed slow query parameters

    Parameter

    Description

    Query ID

    ID of each SQL command

    Start time

    Time when the SQL statement starts to be executed

    End time

    Time when the SQL statement execution ends

    Database

    Queried database

    SQL Statement

    Completed SQL statement

    Latency (ms)

    SQL execution duration

    Status

    SQL status

    User

    User who submitted the SQL statement.

    Remote IP

    Address of the client used by the user who submitted the SQL statement.

Slow SQL Query Statuses

The slow SQL query statuses include FINISHED, RUNNING, or CANCELLED. When the status is RUNNING, Kill Query is displayed in the Operation column.

Table 3 Status description

Status

Description

FINISHED

The SQL statement has been executed.

RUNNING

The SQL statement is running. You can determine whether to stop it.

CANCELLED

The execution of the SQL statement is canceled.