OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.4.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Trace logs

    Last Updated:2026-04-02 06:23:56  Updated
    share
    What is on this page
    Spans and tags
    Examples

    folded

    share

    The end-to-end tracing feature of OceanBase Database can record the time consumed in each stage of the connection from a client to an OceanBase Database Proxy (ODP) and then to an OBServer node, as well as the trace information related to component diagnostics. The trace log records information by span. Each span records the time consumed in an execution interval or module and related information by using tags. The information helps you understand the internal processing logic of the database and locate problems.

    Spans and tags

    Spans and tags are defined in the ob_trace_def.h file and are divided into three levels: HIGH (Level 1), MIDDLE (Level 2), and LOW (Level 3). HIGH is the default level. Spans and tags at Level 1 are recorded by default. To record spans and tags at other levels, run the control command to escalate the trace level. Level 2 spans record information for your analysis. Level 3 spans record more details for diagnostics by OceanBase Database developers. If you set the trace level to N, spans and tags at Level N and lower levels are recorded in the trace log.

    Span definitions are as follows:

    #define HIGH_LEVEL_SPAN
    DEF_SPAN(span_type, comment)
    #undef HIGH_LEVEL_SPAN
    
    #define MIDDLE_LEVEL_SPAN
    DEF_SPAN(span_type, comment)
    #undef MIDDLE_LEVEL_SPAN
    
    #define LOW_LEVEL_SPAN
    DEF_SPAN(span_type, comment)
    #undef LOW_LEVEL_SPAN
    

    Tag definitions are as follows:

    #define HIGH_LEVEL_TAG
    DEF_SPAN(tag_type, comment)
    #undef HIGH_LEVEL_TAG
    
    #define MIDDLE_LEVEL_TAG
    DEF_SPAN(tag_type, comment)
    #undef MIDDLE_LEVEL_TAG
    
    #define LOW_LEVEL_TAG
    DEF_SPAN(tag_type, comment)
    #undef LOW_LEVEL_TAG
    

    Spans are described as follows:

    • com_query_entry: the query procedure.

    • mpquery_single_stmt: the access path of a single statement.

    • sql_compile: specifies to compile an SQL statement.

    • pc_get_plan: specifies to obtain an execution plan.

    • hard_parse: specifies to perform hard parsing.

    • parse: specifies to perform soft parsing.

    • resolve: specifies to parse the semantics of a syntax tree and generate a statement.

    • rewrite: specifies to rewrite an SQL statement.

    • optimize: specifies to perform cost-based optimization and generate execution plan logs.

    • code_generate: specifies to generate a physical execution plan based on the execution plan logs.

    • pc_add_plan: specifies to add a generated execution plan to the plan cache.

    • sql_execute: specifies to execute a physical execution plan.

    • open: specifies to open an execution plan.

    • response_result: the plan execution process and results.

    • px_schedule: specifies to divide tasks by parallel execution (PX).

    • px_task: specifies to execute a PX subtask.

    • close: specifies to close an execution plan.

    • cmd_execute: specifies to execute a command.

    • cmd_open: specifies to open a CMD plan.

    • ps_prepare: specifies to create a prepared statement.

    • ps_execute: specifies to execute a prepared statement.

    • ps_close: specifies to close a prepared statement.

    • pl_entry: specifies to process a stored procedure.

    • pl_compile: specifies to compile stored procedure objects.

    • pc_get_pl_object: specifies to obtain stored procedure objects from the plan cache.

    • pc_add_pl_object: specifies to add stored procedure objects to the plan cache.

    • pl_execute: specifies to execute a stored procedure.

    • pl_spi_query: specifies to execute the SPI statement in the stored procedure.

    • pl_spi_prepare: the preprocessing phase of stored procedures.

    • pl_spi_execute: specifies to execute the SPI statement in the stored procedure.

    • inner_prepare: the preprocessing phase of internal SQL statements.

    • inner_execute: the execution phase of internal SQL statements.

    • inner_execute_read: specifies to read an internal SQL statement.

    • inner_execute_write: specifies to write an internal SQL statement.

    • inner_commit: specifies to commit an internal SQL transaction.

    • inner_rollback: specifies to roll back an internal SQL transaction.

    Tags are described as follows:

    • com_query_entry

      • log_trace_id: the trace ID of the current request in logs.

      • err_code: the error code of the current request.

    • sql_compile

      • sess_id: the session ID.

      • sql_text: the text of the SQL statement.

      • sql_id: the ID of the SQL statement.

      • hit_plan: indicates that the execution plan hits the plan cache.

    • px_task

      • task_id: the logical ID of the parallel task.

      • dfo_id: the data flow operator ID.

      • sqc_id: the ID of the subquery coordinator.

      • qc_id: the ID of the query coordinator.

      • group_id: the ID of the resource group.

    • px_schedule

      • dfo_id: the data flow operator ID.

      • used_worker_cnt: the number of PX worker threads in use.

      • qc_id: the ID of the query coordinator.

    • ps_close

      • ps_id: the ID of the prepared statement.

    Examples

    You can use procedures in the PL/SQL package DBMS_MONITOR as needed to enable or disable end-to-end tracing for an application based on different identifiers and record the trace information into the log files. The sampling frequency determines whether logs are sampled and recorded in the memory. Logs may also be recorded in the trace log file. For more information, see End-to-end tracing. Here is an example:

    +-------------------------------------------+----------------------------+------------+
    | Operation                                 | StartTime                  | ElapseTime |
    +-------------------------------------------+----------------------------+------------+
    | com_query_process                         | 2023-03-22 14:30:27.552259 | 0.405 ms   |
    | └── mpquery_single_stmt             | 2023-03-22 14:30:27.552266 | 0.386 ms   |
    |     ├── sql_compile                 | 2023-03-22 14:30:27.552283 | 0.083 ms   |
    |     │   └── pc_get_plan           | 2023-03-22 14:30:27.552286 | 0.025 ms   |
    |     └── sql_execute                 | 2023-03-22 14:30:27.552379 | 0.242 ms   |
    |         ├── open                    | 2023-03-22 14:30:27.552380 | 0.024 ms   |
    |         ├── response_result         | 2023-03-22 14:30:27.552417 | 0.140 ms   |
    |         │   ├── get_das_id        | 2023-03-22 14:30:27.552421 | 0.000 ms   |
    |         │   └── do_local_das_task | 2023-03-22 14:30:27.552435 | 0.049 ms   |
    |         └── close                   | 2023-03-22 14:30:27.552570 | 0.039 ms   |
    |             ├── close_das_task      | 2023-03-22 14:30:27.552571 | 0.012 ms   |
    |             └── end_transaction     | 2023-03-22 14:30:27.552596 | 0.003 ms   |
    +-------------------------------------------+----------------------------+------------+
    12 rows in set (0.006 sec)
    

    Previous topic

    dump tenant info
    Last

    Next topic

    OCP
    Next
    What is on this page
    Spans and tags
    Examples