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.3.3

    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.3.3
    iconOceanBase Database
    SQL - V 4.3.3
    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_ACTIVE_SESSION_PLAN

    Last Updated:2024-12-02 03:48:27  Updated
    share
    What is on this page
    Syntax
    Parameters
    Examples

    folded

    share

    The DISPLAY_ACTIVE_SESSION_PLAN function displays the active execution plan in the specified session.

    Syntax

    DBMS_XPLAN.DISPLAY_ACTIVE_SESSION_PLAN(
               session_id   INTEGER DEFAULT 0,
               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
               )
    return DISPLAY_ACTIVE_SESSION_PLAN;
    

    Parameters

    Parameter
    Description
    session_id The session ID of the user connection. Note that the value is not the session ID of OceanBase Database Proxy (ODP) but the session ID of the connected OBServer node.
    format The plan format. Valid values:
    • 'BASIC': displays the minimum information in the plan, including the operator ID, operator name, operator description, and expression information.
    • 'TYPICAL': displays the basic information in the plan, including the operator ID, operator name, operator description, number of output rows estimated by the optimizer, execution time estimated by the optimizer, and expression information. If the plan has been executed, feedback on the first execution of the plan is also displayed, including the actual number of output rows and cost.
    • 'ALL': displays the maximum information in the plan, including the operator ID, operator name, operator description, number of output rows estimated by the optimizer, execution time estimated by the optimizer, expression information, effective hints, trace information of query block names, outline information, base table optimization information, constant parameterization information, constraint information, and plan notes.
    • 'ADVANCED': displays the maximum information in the plan, including all information items covered by the 'ALL' type. It also displays tree-structured information for complex plans.
    svr_ip The IP address of the OBServer node where the plan is located. The default value is the IP address of the OBServer node to which the session is connected.
    svr_port The port number of the OBServer node where the plan is located. The default value is the port number of the OBServer node to which the session is connected.

    Examples

    /* Execute a slow SQL statement. */
    obclient> SELECT COUNT(*) FROM TABLE(GENERATOR(100000)) A, TABLE(GENERATOR(10000))B;   
    +------------+
    | COUNT(*)   |
    +------------+
    | 1000000000 |
    +------------+
    1 row in set
    
    /* Connect to another session and run the SHOW PROCESSLIST command to query the ID of the session in which the slow SQL statement is being executed. */
    obclient> SHOW PROCESSLIST;
    +------------+------+--------------------+------+---------+------+--------+---------------------------------------------------------------------------+
    | ID         | USER | HOST               | DB   | COMMAND | TIME | STATE  | INFO                                                                      |
    +------------+------+--------------------+------+---------+------+--------+---------------------------------------------------------------------------+
    | 3221675847 | SYS  | 11.x.x.44:57841 | SYS  | Query   |    0 | ACTIVE | show processlist                                                          |
    | 3221668463 | SYS  | 11.x.x.44:57530 | SYS  | Query   |    2 | ACTIVE | select count(*) from table(generator(100000)) A, table(generator(10000))B |
    +------------+------+--------------------+------+---------+------+--------+---------------------------------------------------------------------------+
    
    /* Display the details of the execution plan of the slow SQL statement based on the obtained session ID. */
    obclient> SELECT DBMS_XPLAN.DISPLAY_ACTIVE_SESSION_PLAN(3221668463);
    +--------------------------------------------------------------------------------------------------------------------+
    | COLUMN_VALUE                                                                                                       |
    +--------------------------------------------------------------------------------------------------------------------+
    | ==============================================================================================================     |
    | |ID|OPERATOR                     |NAME|EST.ROWS|EST.TIME(us)|REAL.ROWS|REAL.TIME(us)|IO TIME(us)|CPU TIME(us)|     |
    | --------------------------------------------------------------------------------------------------------------     |
    | |0 |SCALAR GROUP BY              |    |1       |1794        |0        |0            |0          |0           |     |
    | |1 |└─NESTED-LOOP JOIN CARTESIAN |    |39601   |1076        |0        |0            |0          |0           |     |
    | |2 |  ├─FUNCTION_TABLE           |A   |199     |1           |0        |0            |0          |0           |     |
    | |3 |  └─MATERIAL                 |    |199     |80          |0        |0            |0          |0           |     |
    | |4 |    └─FUNCTION_TABLE         |B   |199     |1           |0        |0            |0          |0           |     |
    | ==============================================================================================================     |
    | Outputs & filters:                                                                                                 |
    | -------------------------------------                                                                              |
    |   0 - output([T_FUN_COUNT(*)]), filter(nil), rowset=256                                                            |
    |       group(nil), agg_func([T_FUN_COUNT(*)])                                                                       |
    |   1 - output(nil), filter(nil), rowset=256                                                                         |
    |       conds(nil), nl_params_(nil), use_batch=false                                                                 |
    |   2 - output(nil), filter(nil)                                                                                     |
    |       value(GENERATOR(cast(:0, BIGINT(-1, 0))))                                                                    |
    |   3 - output(nil), filter(nil), rowset=256                                                                         |
    |   4 - output(nil), filter(nil)                                                                                     |
    |       value(GENERATOR(cast(:1, BIGINT(-1, 0))))                                                                    |
    +--------------------------------------------------------------------------------------------------------------------+
    
    

    Previous topic

    Overview
    Last

    Next topic

    DISPLAY_CURSOR
    Next
    What is on this page
    Syntax
    Parameters
    Examples