Viewing Slow Query Logs
Scenarios
Slow query logs record statements that exceed long_query_time (1 second by default). You can view log details and statistics to identify the statements that are executing slowly and optimize the statements.
- SELECT
- INSERT
- UPDATE
- DELETE
- CREATE
- ALTER
- DROP
Parameter Description
|
Parameter |
Description |
|---|---|
|
long_query_time |
Specifies the time greater than or equal to which slow query logs are recorded. The precision is microsecond. The default value is 1s. When the execution time of an SQL statement exceeds the value of this parameter, the SQL statement is recorded in slow query logs. The recommended value is 1s. Note: The lock wait time is not calculated into the query time. |
|
log_queries_not_using_indexes |
Specifies whether to record the slow query that without indexes. The default value is OFF. |
|
log_throttle_queries_not_using_indexes |
Specifies the SQL statement that can be written to the slow query log every minute. The default value is 0. |
Viewing Log Details
- Log in to the management console.
- Click
in the upper left corner and select a region and a project. - Click Service List. Under Database, click GaussDB.
- On the Instance Management page, click the target DB instance. The Basic Information page is displayed.
- In the navigation pane on the left, choose Logs.
- On the Slow Query Logs page, view the slow query log details.
You can view the slow query log records of a specified execution statement type or a specific time period.
Last Article: Viewing Error Logs
Next Article: Task Center
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.