OceanBase logo

OceanBase

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

Product Overview
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

OceanBase

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

Product Overview
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.6.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    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.6.0
    iconOceanBase Database
    SQL - V 4.6.0
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • 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

    DISPLAY_SQL_PLAN_BASELINE

    Last Updated:2026-05-07 11:26:25  Updated
    Share
    What is on this page
    Syntax
    Parameters
    Examples

    folded

    Share

    The DISPLAY_SQL_PLAN_BASELINE function is used to view the baseline plans in the SQL Plan Management (SPM) system.

    Syntax

    DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE(
               sql_handle   VARCHAR2  DEFAULT  NULL,
               plan_name    VARCHAR2  DEFAULT  NULL,
               format       VARCHAR2  DEFAULT  'TYPICAL',
               svr_ip       VARCHAR2 DEFAULT null,   -- default value: server connected by client
               svr_port     INTEGER DEFAULT 0,     -- default value: server connected by client
               tenant_id    INTEGER DEFAULT 0     -- default value: current tenant)
    RETURN DBMS_XPLAN_TYPE_TABLE;
    

    Parameters

    Parameter
    Description
    sql_handle The SQL handle of the baseline plan. You can obtain the SQL handle from the SPM views.
    plan_name The name of the baseline plan.
    format The plan format. Valid values:
    • 'BASIC': displays basic information such as operator ID, operator name, operator remarks, and expression.
    • 'TYPICAL': displays basic information such as operator ID, operator name, operator remarks, optimizer-estimated output rows, optimizer-estimated execution time, and expression. If the plan has been executed, it also displays the actual feedback information of the first execution, such as actual rows and cost.
    • 'ALL': displays rich plan information such as operator ID, operator name, operator remarks, optimizer-estimated output rows, optimizer-estimated execution time, expression, effective hint, query block name trace, outline, base table optimization, constant parameterization, constraint, and plan note.
    • 'ADVANCED': displays rich plan information such as operator ID, operator name, operator remarks, optimizer-estimated output rows, optimizer-estimated execution time, expression, effective hint, query block name trace, outline, base table optimization, constant parameterization, constraint, and plan note. In addition, it displays the tree structure information for complex plans.
    svr_ip The IP address of the node where the plan is located. The default value is the IP address of the node to which the current session is connected.
    svr_port The port number of the node where the plan is located. The default value is the port number of the node to which the current session is connected.
    tenant_id The tenant ID to which the plan belongs. The default value is the tenant ID to which the current session is connected.

    Examples

    /* Enable SPM for the current session. */
    SET SESSION optimizer_use_sql_plan_baselines = 'ON';
    SET SESSION optimizer_capture_sql_plan_baselines = 'ON';
    
    /* Create a baseline plan. */
    CREATE TABLE t1(c1 INT);
    SELECT * FROM t1 WHERE c1 > 1;
    
    /* Query the ID of the baseline plan. */
    obclient> SELECT sql_handle,plan_name FROM oceanbase.DBA_SQL_PLAN_BASELINES;
    +----------------------------------+----------------------+
    | SQL_HANDLE                       | PLAN_NAME            |
    +----------------------------------+----------------------+
    | 49D6048C041AA8C7E70E2D114250AB99 | 11986391583431335905 |
    +----------------------------------+----------------------+
    
    /* View the baseline plan */
    obclient> SELECT DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE('49D6048C041AA8C7E70E2D114250AB99','11986391583431335905','all');
    +------------------------------------------------------------------------------------------------------------------+
    | COLUMN_VALUE                                                                                                     |
    +------------------------------------------------------------------------------------------------------------------+
    | ================================================================================================                 |
    | |ID|OPERATOR       |NAME|EST.ROWS|EST.TIME(us)|REAL.ROWS|REAL.TIME(us)|IO TIME(us)|CPU TIME(us)|                 |
    | ------------------------------------------------------------------------------------------------                 |
    | |0 |TABLE FULL SCAN|T1  |1       |2           |0        |0            |0          |0           |                 |
    | ================================================================================================                 |
    | Outputs & filters:                                                                                               |
    | -------------------------------------                                                                            |
    |   0 - output([T1.C1]), filter([T1.C1 > :0]), rowset=256                                                          |
    |       access([T1.C1]), partitions(p0)                                                                            |
    |       is_index_back=false, is_global_index=false, filter_before_indexback[false],                                |
    |       range_key([T1.__pk_increment]), range(MIN ; MAX)always true                                                |
    | Used Hint:                                                                                                       |
    | -------------------------------------                                                                            |
    |   /*+                                                                                                            |
    |                                                                                                                  |
    |   */                                                                                                             |
    | Qb name trace:                                                                                                   |
    | -------------------------------------                                                                            |
    |   stmt_id:0, SEL$1                                                                                               |
    | Outline Data:                                                                                                    |
    | -------------------------------------                                                                            |
    |   /*+                                                                                                            |
    |       BEGIN_OUTLINE_DATA                                                                                         |
    |       FULL(@"SEL$1" "SYS"."T1"@"SEL$1")                                                                          |
    |       OPTIMIZER_FEATURES_ENABLE('4.0.0.0')                                                                       |
    |       END_OUTLINE_DATA                                                                                           |
    |   */                                                                                                             |
    | Optimization Info:                                                                                               |
    | -------------------------------------                                                                            |
    |   T1:                                                                                                            |
    |       table_rows:1                                                                                               |
    |       physical_range_rows:1                                                                                      |
    |       logical_range_rows:1                                                                                       |
    |       index_back_rows:0                                                                                          |
    |       output_rows:0                                                                                              |
    |       avaiable_index_name:[T1]                                                                                   |
    |       stats version:0                                                                                            |
    |   Plan Type:                                                                                                     |
    |       LOCAL                                                                                                      |
    |   Parameters:                                                                                                    |
    |       :0 => 1                                                                                                    |
    | SQL text:                                                                                                        |
    | -------------------------------------                                                                            |
    |   select * from t1 where c1 > 1                                                                                  |
    | Outline data:                                                                                                    |
    | -------------------------------------                                                                            |
    |   /*+BEGIN_OUTLINE_DATA FULL(@"SEL$1" "SYS"."T1"@"SEL$1") OPTIMIZER_FEATURES_ENABLE('4.0.0.0')END_OUTLINE_DATA*/ |
    | SQL handle:                                                                                                      |
    | -------------------------------------                                                                            |
    |   49D6048C041AA8C7E70E2D114250AB99                                                                               |
    | Plan name:                                                                                                       |
    | -------------------------------------                                                                            |
    |   11986391583431335905                                                                                           |
    | Baseline info:                                                                                                   |
    | -------------------------------------                                                                            |
    |   Origin: AUTO-CAPTURE    Accepted: YES    Fixed: NO    Enabled: YES                                             |
    |   Plan rows: From plan cahe                                                                                      |
    +------------------------------------------------------------------------------------------------------------------+
    

    Previous topic

    DISABLE_OPT_TRACE
    Last

    Next topic

    ENABLE_OPT_TRACE
    Next
    What is on this page
    Syntax
    Parameters
    Examples