tencent cloud

Feedback

Querying and Downloading Slow Query Log

Last updated: 2025-01-06 11:23:46
    The slow query log records the query statements that take more time than the specified value to execute in TencentDB for SQL Server. It enables you to find out inefficient query statements for optimization. Typically, it is a SQL statement for troubleshooting and an important feature for checking the performance of the current TencentDB for SQL Server instance. This document describes how to query and download a slow query log in the console.
    Note:
    The log is stored in the Beijing time zone (UTC+8) by default. If the default time zone is modified, it will be stored in the time zone of the instance server, but its storage time will still be in Beijing time in the console.

    Use Limits

    The collection of slow query is enabled by default and cannot be disabled.
    The collection threshold of slow query is 1s (or 1,000 ms) by default, and SQL executions exceeding 1s will be recorded as a slow query log.
    The slow query logs are collected every 5 minutes by default, and SQL statements exceeding 1s will be recorded.
    The slow query logs are retained for 7 days by default and will be automatically deleted upon expiration.

    Description of Fields Contained in Slow Query Log Files

    Field Name
    Description
    client_app_name
    Client application name.
    client_hostname
    Client hostname.
    cpu_time
    CPU time used by a remote procedure call, in microseconds.
    duration
    Time required to complete a remote procedure call, in microseconds.
    last_row_count
    Number of rows returned by the last executed SQL statement.
    line_number
    Line number of a SQL statement in the source file.
    logical_reads
    Number of logical reads during execution.
    offset
    Start offset of a SQL statement in the source file.
    offset_end
    End offset of a SQL statement in the source file.
    parameterized
    Specifies whether a SQL statement is parameterized.
    physical_reads
    Number of physical reads during execution.
    row_count
    Number of rows returned.
    spills
    Number of pages written to the overflow database during query execution.
    sql_text
    Text content of a SQL statement.
    statement
    Executed SQL statement.
    username
    Username for performing an operation.
    writes
    Number of writes during query execution.
    connection_reset_option
    Option used to reset a connection. This field only applies to resetting the connection for remote procedure calls.
    client_connection_id
    Optional identifier provided by the client upon connection.
    data_stream
    Binary stream for replaying the trace of a remote procedure call.
    database_name
    Database name.
    object_name
    Object name referenced by a remote procedure call.
    output_parameters
    Output parameters returned from a remote procedure call.
    query_plan_hash
    Query plan hash, which can be used to identify similar query execution plans. You can use the query plan hash to find the cumulative overheads of queries with similar execution plans.
    result
    Return value of a remote procedure call.

    Directions

    2. Select the region at the top, find the target instance, and click the instance ID or Manage in the Operation column to enter the instance management page.
    
    
    3. On the instance management page, select the Operation Log tab > Slow Query Log to see slow log list.
    You can view the following fields: File Name, Start Time of File Generation, End Time of File Generation, File Size, and Operation (Download).
    You can search for slow logs generated in the last 5/15/30 minutes, last 1/3/24 hours, today, yesterday, last 3/7/30 days, or a custom time range.
    
    4. Click Download in the Operation column to download slow query log files.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support