Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle View SQL execution Plan 1--explain plan

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Syntax:

Explain plan for + Target SQL

Select * from table (dbms_xplan.display)

Eg:

SQL > explain plan for select empno,ename,dname from scott.emp,scott.dept where emp.deptno=dept.deptno

Explained.

SQL > set linesize 800

SQL > select * from table (dbms_xplan.display)

PLAN_TABLE_OUTPUT

-

Plan hash value: 844388907

| | Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |

-

| | 0 | SELECT STATEMENT | | 14 | 364 | 6 (17) | 00:00:01 |

| | 1 | MERGE JOIN | | 14 | 364 | 6 (17) | 00:00:01 |

| | 2 | TABLE ACCESS BY INDEX ROWID | DEPT | 4 | 52 | 2 (0) | 00:00:01 |

| | 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0) | 00:00:01 |

| | * 4 | SORT JOIN | | 14 | 182 | 4 (25) | 00:00:01 |

| | 5 | TABLE ACCESS FULL | EMP | 14 | 182 | 3 (0) | 00:00:01 |

PLAN_TABLE_OUTPUT

-

Predicate Information (identified by operation id):

4-access ("EMP". "DEPTNO" = "DEPT". "DEPTNO")

Filter ("EMP". "DEPTNO" = "DEPT". "DEPTNO")

18 rows selected.

In Oracle10g\ 11g, if we execute the explain plan command on the target SQL, oracle writes the specific execution steps of the execution plan generated by parsing the target SQL into the PLAN_TABLE$, and then executes select * from table (dbms_xplan.display), just showing these specific execution steps in a formatted manner from the PLAN_TABLE$.

PLAN_TABLE$ is a global temporary table of on commit preserve rows, so here Oracle can make sure that each session can only see the execution plan generated by the SQL that it executes, and the process of each session writing the execution plan to the PLAN_TABLE$ does not interfere with each other.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report