Help Center/ GaussDB/ User Guide/ Diagnostics and Optimization/ Performing Full-Link Analysis for a SQL Record
Updated on 2025-09-05 GMT+08:00

Performing Full-Link Analysis for a SQL Record

Scenarios

You can query details about SQL execution links using the unique SQL ID or transaction ID of an application SQL statement.

Prerequisites

  • You have logged in using an account assigned the gaussdb:instance:listSqlLink action.
  • SQL Explorer has been enabled, and valid data has been collected.

Constraints

  • If the transaction ID is 0, it cannot be used to query link details.
  • If the unique SQL ID is 0, no link information is available.
  • The DB engine version of GaussDB instances must be V2.0-8.0.1 or later, and the kernel version must be 505.0.0 or later. For details about how to query the version, see Checking the DB Engine and Kernel Engine Version of a GaussDB Instance.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page and choose Databases > GaussDB.
  4. On the Instances page, click the name of the target instance to go to the Basic Information page.
  5. Choose Diagnostics and Optimization > SQL Diagnosis and click the SQL Explorer tab.
  6. On the Full SQL Statistics tab, click to expand the target row. Alternatively, click the Full Data by SQL Statement tab.
  7. Click the transaction ID or click More in the Operation column and choose End-to-End Trace to go to the SQL full-link analysis page.

    • If you click More in the Operation column and choose End-to-End Trace, the execution link details of the SQL statement are displayed.
    • If you click a transaction ID (which is not 0), the execution link details of the transaction are displayed.
    Figure 1 SQL link information

    Table 1 Parameters for SQL link analysis

    Module

    Parameter

    Description

    Elapsed Time for Resources

    CPU

    Time spent on CPU processing

    I/O

    Time spent on I/O operations

    Others

    Valid DB time minus the CPU and I/O time

    Elapsed Time for Kernel Execution

    SQL Parsing

    Time spent on parsing the SQL statement

    Query Rewriting

    Time spent on rewriting the SQL statement

    Execution Plan Generation

    Time spent on generating a SQL execution plan

    Execution in Executor

    Time spent on executing the SQL statement

    Others

    Total SQL execution time minus the time spent on SQL parsing, SQL rewriting, SQL plan generation, and execution in the executor

    Elapsed Time for Code-related Wait Events

    Top 5 Events by Elapsed Time

    Top events with the longest elapsed time

    Elapsed Time for Other Events

    Time consumed by all events minus the time consumed by top 5 events

    Others

    Valid DB time minus the time consumed by all wait event code

    Elapsed Time for Resource-related Wait Events - Elapsed Time for I/O

    Top 5 Events by Elapsed Time

    The most time-consuming I/O events

    Elapsed Time for Other Events

    Time consumed by all I/O events minus the time consumed by top 5 I/O events

    Others

    Valid DB time minus the time consumed by all I/O wait events

    Elapsed Time for Resource-related Wait Events - Elapsed Time for Locks

    Top 5 Events by Elapsed Time

    The most time-consuming lock events

    Elapsed Time for Other Events

    Time consumed by all lock events minus the time consumed by top 5 lock events

    Others

    Valid DB time minus the time consumed by all lock events

    Elapsed Time for Resource-related Wait Events - Elapsed Time for Lightweight Locks

    Top 5 Events by Elapsed Time

    The most time-consuming lightweight lock events

    Elapsed Time for Other Events

    Time consumed by all lightweight lock events minus the time consumed by top 5 lightweight lock events

    Others

    Valid DB time minus the time consumed by all lightweight lock events

    For details about wait event parameters, see the description of wait_status and wait_event in "Developer Guide" > "System Catalogs and System Views" > "System Views" > "Other System Views" > "PG_THREAD_WAIT_STATUS."

  8. Hover the pointer over a node to view the details about SQL execution on that node.

    Figure 2 SQL execution information

    DB Time indicates the total DB time, in microseconds, which is accumulated if multiple threads are involved. The way for collecting DB time statistics is slightly different from that for collecting start/end time statistics, but the difference does not affect performance issue analysis.