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 Developer Center

V4.4.0

  • Topics Overview
  • Overview
    • What is ODC?
    • Features
    • Architecture
    • Limitations
    • ODC console
  • Quick Start
    • Client ODC
      • Overview
      • Install Client ODC
      • Use Client ODC
    • Web ODC
      • Overview
      • Deploy Web ODC
      • Use Web ODC
  • Data Source Management
    • Create a data source
    • Data sources and project collaboration
    • Database O&M
      • Session management
      • Global variable management
      • Recycle bin management
  • SQL Development
    • Edit and execute SQL statements
    • Perform PL compilation and debugging
    • Use the command-line window
    • Edit and export the result set of an SQL statement
    • Execution analysis
    • Generate test data
    • System settings
    • Database objects
      • Table objects
        • Overview
        • Create a table
      • View objects
        • Overview
        • Create a view
        • Manage views
      • Materialized view objects
        • Overview
        • Create a materialized view
        • Manage materialized views
      • Function objects
        • Overview
        • Create a function
        • Manage functions
      • Stored procedure objects
        • Overview
        • Create a stored procedure
        • Manage stored procedures
      • Sequence objects
        • Overview
        • Create a sequence
        • Manage sequences
      • Package objects
        • Overview
        • Create a program package
        • Manage program packages
      • Trigger objects
        • Overview
        • Create a trigger
        • Manage triggers
      • Type objects
        • Overview
        • Create a type
        • Manage types
      • Synonym objects
        • Overview
        • Create a synonym
        • Manage synonyms
  • Import and Export
    • Import schemas and data
    • Export schemas and data
  • Database Change Management
    • Manage user permissions
      • Users and roles
      • Automatic authorization
      • User permission management
    • Project collaboration management
    • Risk levels, risk identification rules, and approval processes
    • SQL check specifications
    • SQL window specification
    • Database change management
    • Manage changes to logical databases
    • Batch database change management
    • Online schema changes
    • Synchronize shadow tables
    • Schema comparison
  • Data Lifecycle Management
    • Data archiving
    • Data cleanup
    • Manage partitioning plans
      • Manage partitioning plans
      • Set partitioning strategies
      • Examples of partitioning strategies
    • SQL plan task
  • Data Masking and Auditing
    • Desensitize data
    • Operation records
  • Notification Management
    • Overview
    • View notification records
    • Manage notification channels
      • Create a notification channel
      • View, edit, and delete a notification channel
      • Configure a custom channel
    • Manage notification rules
  • System Integration
    • Login integration
    • Approval integration
    • SQL approval integration
    • Bastion host integration
  • Deployment Guide
    • Deployment overview
    • Preparations before deployment
    • Deploy ODC in single-node mode
    • Deploy ODC in high-availability mode
    • Deployment verification
  • Upgrade Guide
    • Upgrade Overview
    • Preparations before upgrade
    • Update single-node ODC
    • Update high-avaliability ODC
    • Upgrade verification
    • Rollback after upgrade failed
  • Best Practices
    • Tips for SQL development
    • Explore ODC team workspaces
    • Understanding real-time SQL diagnostics for OceanBase AP
    • OceanBase historical database solutions
    • ODC SQL check for automatic identification of high-risk operations
    • Integration with ODC enterprise-level account system
    • Manage and modify sharded databases and tables via ODC
    • Data masking and control practices
    • Enterprise-level control and collaboration: Safeguard every database change
  • Troubleshooting
    • ODC troubleshooting process
    • Collect message
      • View the runtime environment and version information
      • View web ODC logs
      • View client ODC logs
      • View end-to-end ODC-related logs
      • View ODC MetaDB data
      • Query the index status in OceanBase Database V4.x
      • Query the index status in OceanBase Database V1.4.x to V3.2.x
      • Collect JVM runtime information
      • Use tcpdump to capture packets
    • FAQ
      • Installation of client ODC
      • Web ODC deployment and startup
      • Connection Information
      • Command-line window
      • DDL statement display
  • Common features
  • Release Notes
    • V4.4
      • ODC V4.4.0
    • V4.3
      • ODC V4.3.4
      • ODC V4.3.3
      • ODC V4.3.2
      • ODC V4.3.1
      • ODC V4.3.0
    • V4.2
      • ODC V4.2.4
      • ODC V4.2.3
      • ODC V4.2.2
      • ODC V4.2.1
      • ODC V4.2.0
    • V4.1
      • ODC V4.1.3
      • ODC V4.1.2
      • ODC V4.1.1
      • ODC V4.1.0
    • V4.0
      • ODC V4.0.2
      • ODC V4.0.0
    • V3.4
      • ODC V3.4.0
    • V3.3
      • ODC V3.3.3
      • ODC V3.3.2
      • ODC V3.3.1
      • ODC V3.3.0
    • V3.2
      • ODC V3.2.3
      • ODC V3.2.2
      • ODC V3.2.1
      • ODC V3.2.0

Download PDF

Topics Overview What is ODC? Features Architecture Limitations ODC console Overview Install Client ODC Use Client ODC Overview Deploy Web ODC Use Web ODC Create a data source Data sources and project collaboration Session management Global variable management Recycle bin management Edit and execute SQL statements Perform PL compilation and debugging Use the command-line window Edit and export the result set of an SQL statement Execution analysis Generate test data System settings Import schemas and data Export schemas and data Users and roles Automatic authorization User permission management Project collaboration management Risk levels, risk identification rules, and approval processes SQL check specifications SQL window specification Database change management Manage changes to logical databases Batch database change management Online schema changes Synchronize shadow tables Schema comparison Data archiving Data cleanup Manage partitioning plans Set partitioning strategies Examples of partitioning strategies SQL plan task Desensitize data Operation records Overview View notification records Create a notification channel View, edit, and delete a notification channel Configure a custom channel Manage notification rules Login integration Approval integration SQL approval integration Bastion host integration Deployment overview Preparations before deployment Deploy ODC in single-node mode Deploy ODC in high-availability mode Deployment verification Upgrade Overview Preparations before upgrade Update single-node ODC Update high-avaliability ODC Upgrade verification Rollback after upgrade failed Tips for SQL development Explore ODC team workspaces Understanding real-time SQL diagnostics for OceanBase AP OceanBase historical database solutions ODC SQL check for automatic identification of high-risk operations Integration with ODC enterprise-level account system Manage and modify sharded databases and tables via ODC Data masking and control practices Enterprise-level control and collaboration: Safeguard every database change ODC troubleshooting process View the runtime environment and version information View web ODC logs View client ODC logs View end-to-end ODC-related logs View ODC MetaDB data Query the index status in OceanBase Database V4.x Query the index status in OceanBase Database V1.4.x to V3.2.x Collect JVM runtime information Use tcpdump to capture packets Installation of client ODC Web ODC deployment and startup Connection Information Command-line window DDL statement display Common features ODC V4.4.0 ODC V4.3.4 ODC V4.3.3 ODC V4.3.2 ODC V4.3.1 ODC V4.3.0 ODC V4.2.4
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 Developer Center
  3. V4.4.0
iconOceanBase Developer Center
V 4.4.0
  • V 4.4.2
  • V 4.4.1
  • V 4.4.0
  • V 4.3.4
  • V 4.3.3
  • V 4.3.2
  • V 4.3.1
  • V 4.3.0
  • V 4.2.4
  • V 4.2.3
  • V 4.2.2
  • V 4.2.1
  • V 4.2.0
  • V 4.1.3 and earlier

Understanding real-time SQL diagnostics for OceanBase AP

Last Updated:2026-04-07 10:00:35  Updated
share
What is on this page
Background information
Scenarios
Diagnostics for AP scenarios in OceanBase Database
Challenges in AP scenarios
OceanBase diagnostic tools
Real-time performance bottleneck analysis with SQL Plan Monitor
Real-time SQL diagnostics in OceanBase Database
Challenges for developers in analyzing slow SQL queries
Real-time SQL execution analysis
References

folded

share

Background information

With the explosive growth of data volume and the evolving user needs, database management and optimization have become increasingly critical. As database administrators (DBAs) and developers, you often encounter the following challenges:

  • In an AP scenario, long-running queries that process a large amount of data and perform complex calculations require real-time monitoring of their running status.

  • In a multi-node online environment, you need to determine whether a slow SQL statement is caused by a distributed execution plan issue and, if so, identify the long-tail node that hinders the performance of the entire plan.

  • You need to determine whether a slow SQL statement is caused by unrepresentative SQL parameters when the execution plan is generated or inaccurate statistics.

Distributed databases face more complex scenarios and involve more execution links than standalone databases. A single SQL statement may require collaboration among dozens of nodes. If a slow SQL statement cannot be resolved in time, it may cause blocking of normal requests, soaring CPU load, or even unavailability of the entire cluster.

Scenarios

As a native distributed database, OceanBase Database continuously enhances database management and operations efficiency, and optimizes diagnostic and tuning experiences. This topic will share best practices and insights of OceanBase Database in efficient diagnostics, including:

  • An exploration of execution performance challenges in AP scenarios and an introduction of common diagnostic tools.

  • A case study demonstrating how to use the real-time plan monitor to diagnose distributed plans.

  • Thoughts on simplifying and optimizing the diagnostic and tuning process, and an introduction to OceanBase's real-time SQL diagnostics.

Diagnostics for AP scenarios in OceanBase Database

Challenges in AP scenarios

In an analytical processing (AP) scenario, each execution involves a large amount of data, requires complex multidimensional modeling, and relies on large-scale parallelism to accelerate queries.

1

In this scenario, common performance issues in distributed databases include the following areas:

  1. Scan large amounts of data.

    Many analytical queries process a large amount of data, which often results in full table scans or scans of large data ranges. This causes high I/O and long response times. Poorly designed partitions may fail to be pruned, expanding the query range and causing unnecessary data scans. Partitions in OceanBase Database can be distributed across nodes or even data centers. Therefore, efficient data scanning across nodes or data centers is essential for cross-partition queries.

  2. Aggregate and join multiple tables.

    • Complex aggregate functions: Aggregate functions such as COUNT, SUM, AVG, MAX, and MIN are frequently used in analytical scenarios. However, they can be very time-consuming to execute on large datasets.

    • GROUP BY processing: High-cardinality GROUP BY operations consume a large amount of memory and CPU resources, which undermines query performance.

    • Large JOIN operations: Analysis queries often involve joining multiple large tables. JOIN operations consume a large amount of memory and CPU resources. If the join condition is not properly chosen, the efficiency can be very low.

    • Unreasonable join order: If the optimizer chooses an unreasonable join order, the intermediate result sets will grow, which will degrade the query performance.

  3. The parallel computing performance does not meet expectations.

    AP business scenarios rely on high-performance computing to accelerate queries. However, if the parallel performance is suboptimal, it is unclear whether the issue is caused by insufficient system configuration or the SQL statement itself. In addition, since SQL statements executed in AP scenarios usually take a long time and their execution process is invisible to users, monitoring the real-time information and execution status of SQL statements is also a key feature in AP scenarios. These challenges require systematic diagnostic tools and optimization strategies to effectively address them and improve the performance and reliability of OceanBase Database in AP scenarios.

OceanBase diagnostic tools

To address these challenges, OceanBase Database offers a series of user diagnostic and tuning tools, including SQL Audit, End-to-end Trace, and DBMS_XPLAN.

2

For example, you can perform the following steps to diagnose SQL issues at the SQL level by using the SQL Audit view:

  • View the retry count: If the retry count is high, there may be a lock conflict or a switchover.

  • Check whether the queue time is long: If the queue time of a SQL statement is long, it will cause jitter. In this case, the SQL statement with a long queue time but a short execution time is usually affected by the jitter rather than the cause of the jitter. This is because the reason for the jitter is generally that a specific SQL statement takes a long time to execute, causing other SQL statements to wait in the queue for the CPU.

  • Check whether the execution plan acquisition time (GET_PLAN_TIME) is long: If yes, the SQL statement did not hit a plan but went through the entire plan generation process again, and generally, IS_HIT_PLAN=0.

  • Check if EXECUTE_TIME is long: If it is, you can use SQL to check for long-running wait events. For example, if you find that the SQL spends a significant amount of time waiting for I/O, you can investigate whether the disk status was normal during the spike period.

Real-time performance bottleneck analysis with SQL Plan Monitor

Although OceanBase Database provides various diagnostic tools, AP scenarios still lack execution monitoring at the SQL operator level. For example, it is unclear how the execution tasks are divided in a parallel operation, whether data skew occurs, how severe the hash conflicts are, and which operator the execution is hung on. These issues can be identified only from logs.

If a summary analysis of an SQL query is completed but the slow SQL query is still not identified, the problem might be with the SQL query itself rather than the scheduling. In this case, you can use the SQL_PLAN_MONITOR view for operator-level analysis.

The SQL_PLAN_MONITOR view is a powerful tool for real-time monitoring of the execution of SQL statements. It allows you to understand the resource consumption and execution status of an SQL statement during execution, including the number of concurrent operators, rows produced by each thread, number of scanned rows, and actual execution time. You can use this information for further diagnostics.

  1. Query performance bottleneck

    The SQL_PLAN_MONITOR view records the output rows and execution time of each operator during execution. These are the first data items to be checked for performance diagnostics. Generally, you can identify the slowest operator based on the number of threads (concurrency) used by each operator, the total number of rows output, and the timestamps for first and last row output.

    Take the TPC-H Q17 as an example. The execution record is as follows:

    3

    Based on the data in the figure and the execution plan, you can see that the scan of the LINEITEM table and the HASH JOIN with operator ID 7 are the bottlenecks of this execution. The scan of the PART table is completed quickly. In this case, you can add a index to the join column of the right table.

    After the index is added, the execution record is as follows. The join strategy is changed from HASH JOIN to NLJ to avoid a full-table scan of the LINEITEM table. The execution time is reduced from 30s to 4s.

    4

  2. Real-time I/O data

    In version 4.2.4 and later, the SQL_PLAN_MONITOR view allows you to view the timing and I/O data of each thread of an operator in real time. You can obtain the I/O data from the OTHERSTAT_x_KEY and OTHERSTAT_x_VALUE columns. The correspondence between the keys and values is described in the V$SQL_MONITOR_STATNAME view. The I/O-related fields in the view are as follows:

    33: total io bytes read from disk
    34: total bytes processed by ssstore
    35: total rows processed by ssstore
    36: total rows processed by memstore
    

    A snippet of the data is as follows. It shows that all data of the operator is scanned from SSTables, and less than 1% of the scanned rows are output. This means that the query needs to be optimized for the table, for example, by adjusting the filter condition or creating an index on the filter column.

    5

  3. Load imbalance

    When data is unevenly distributed across distribution nodes, some nodes may be overloaded with a large amount of data processing tasks, while other nodes have almost no workload. This causes single-point bottlenecks and degrades overall performance.

    For example, a large table has dozens of partitions. If 90% of the data, which is the peak data of one day, is concentrated in one partition, the data in this partition accounts for 90% of the total data. In this case, if you parallelize the task of counting the different values of a specified column and each thread calculates the results of some partitions, you can imagine the parallel execution effect: threads finish their tasks on smaller partitions much earlier, but a thread responsible for a larger partition needs a long time to complete its task. Other partitions have to wait for this thread to finish its task. This causes low overall performance. The parallel execution efficiency is very low in this case because the workload of each thread is unbalanced.

    In actual business scenarios, you can use the SQL_PLAN_MONITOR view to diagnose load imbalance issues. The view records the details of each thread on every node. If parallel execution performance is not as expected, you can compare the records of the same operator and different threads to identify whether there is a straggler slowing down the entire execution process.

Real-time SQL diagnostics in OceanBase Database

Challenges for developers in analyzing slow SQL queries

Although OceanBase Database currently offers some diagnostic and tuning tools, there are still some challenges, especially for developers:

  • The complexity of using multiple steps and tools requires in-depth knowledge of databases and OceanBase Database kernels.

  • The diagnostic and tuning process is complex and cumbersome, involving the management and maintenance of a large number of SQL queries and scripts.

  • High learning costs. Effective SQL diagnostics require professional training and substantial experience.

Real-time SQL execution analysis

To address these challenges and further improve the real-time and accuracy of SQL diagnostics, OceanBase Database has introduced the new Query Profile (execution analysis) feature in ODC V4.3.1. Query Profile visualizes the real-time SQL plan monitor feature in OceanBase Database V4.x. It can query and display the execution status of actual plans in real time during SQL execution, and details the execution time and resource usage of each operator in the plan.

With the execution analysis feature, combined with the existing visualization features of ODC for execution plans and end-to-end tracing, users can easily identify execution bottlenecks and understand the performance overhead of each operation to analyze and optimize query performance. The execution analysis feature helps answer the following key questions:

  • How much data is to be processed?

  • Where are the bottlenecks?

  • Which columns are most frequently used in filters and joins?

  • Do these columns filter out most data or do they always extract most rows?

The TPC-H Q15 statement queries the top supplier (ranked first) that contributes the most to the total income within a specified period of time. This information can be used to decide which top suppliers to reward, to give more orders to, to certify specially, or to encourage. The Q15 statement is a complex statement that involves a join between a table and a view, and the join involves grouping, sorting, aggregation, and subqueries. Use this example to learn about the features and structure of the execution analysis feature. After the statement is executed in ODC, click the Execution Profile button in the result pane.

6

In the execution overview section of the pane that appears, you can see basic information about the SQL execution, such as whether the execution plan is a distributed plan, whether the plan is cached, and the total execution time. This information can be used as the background for diagnostics.

The graphical view details the scheduling order of the execution plan. Generally, you can read the execution plan from bottom to top. However, the execution analysis feature in ODC highlights the CPU costs actually spent by each operator with a blue progress bar and sorts the most time-consuming five nodes, making it much easier to identify performance bottlenecks. Based on the preceding visual views, you can quickly draw the following conclusions:

  1. The time spent at each node: The time spent is the key to identifying performance issues. You can quickly identify bottlenecks from the total execution time of each operator and analyze the causes. In the preceding example, the longest-running node in the query is the scan node of the "LINEITEM" table. You can also see that the main performance bottleneck lies on the left side of the root node.

  2. The number of rows output at each node: The LINEITEM table outputs approximately 2.3 million records, while the other operators output no more than 1 row on the right side.

With some basic information and an understanding of the general performance bottleneck, you can dive into the second part of the execution analysis: I/O statistics and operator attributes.

As shown in the right-side part of the preceding figure, the overview section displays the overall query information. Key simple metrics that you can view include the total CPU time, the total I/O time, the actual execution time, and the number of rows and bytes read (how much data to process, which is key). These metrics are the starting point for diagnostics. Generally, they can help you resolve most queries. In the preceding example, you can observe a key finding in the graph: The bottleneck lies in the left subtree of the plan. Click the "TABLE FULL SCAN" node, which is the identified bottleneck, to view the execution details of the operator as shown in the following figure:

7

The total rows processed by ssstore field in the I/O statistics section on the right side of the pane indicates that the current node has performed a full table scan. This scan did not use an index, even though an index has been created on the L_SHAPEDATE column. This may be because the optimizer evaluates that an index scan would process more rows.

The shape of the node indicates the type of the operator. In this example, the operator is a distributed operator. The execution overview shows that the parallelism of the operator is 15 and the skewness is 0.1. A small skewness indicates that the workload is evenly distributed among threads and that there are no long-tail nodes that slow down the overall performance.

If you want to query the details of each thread, you can switch to the thread view on the right side and view the row output, the time spent, and the number of rescans of each thread. ODC allows you to sort threads by time, memory, or row output to quickly locate bottleneck threads.

In addition, ODC V4.3.1 has comprehensively redesigned the SQL diagnostics-related features. It provides the execution analysis, execution plan, and end-to-end diagnostics views on one interactive page, supports multiple view modes, and enhances the efficiency of identifying distributed query issues.

8

References

Execution analysis

Previous topic

Explore ODC team workspaces
Last

Next topic

OceanBase historical database solutions
Next
What is on this page
Background information
Scenarios
Diagnostics for AP scenarios in OceanBase Database
Challenges in AP scenarios
OceanBase diagnostic tools
Real-time performance bottleneck analysis with SQL Plan Monitor
Real-time SQL diagnostics in OceanBase Database
Challenges for developers in analyzing slow SQL queries
Real-time SQL execution analysis
References