Get the App
SLTechnology News&Howtos  ›  Database  › 

Get the implementation plan method II-explain plan

Shulou Source: shulou.com Published: 2022-06-01 13:15:46 10月27日 Update

1 installation

The $ORACLE_HOME/rdbms/admin/utlxplan.sql (UNIX) script generates a table. This program creates a table called plan_table.

2 run

Explain PLAN [SET STATEMENT_ID [=]

< string literal >

] [INTO

< table_name >

]

FOR

< sql_statement >

Where:

STATEMENT_ID: is a unique string that distinguishes the current execution plan from other execution plans stored in the same PLAN.

TABLE_NAME: is the name of the plan table, which is structured as shown earlier, and you can set this name as you like.

SQL_STATEMENT: is a real SQL statement.

3 run

S

QL > select * from table (dbms_xplan.display) PLAN_TABLE_OUTPUT- -Plan hash value: 27200 2086 Murray- -| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |- -| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0) | 00:00:01 | | 1 | TABLE ACCESS FULL | DUAL | 1 | 2 | 2 (0) | 00:00:01 |- -8 rows selected.

Or

SELECT A.OPERATION,OPTIONS,OBJECT_NAME,OBJECT_TYPE,ID,PARENT_IDFROM PLAN_TABLE aWHERE STATEMENT_ID='laodao'ORDER BY Id

Tags: Run create name character string program structure script statement antecedent storage generation method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info vpn Shulou Information OPPO Reno