How Does Oracle view the real SQL Execution Plan?

Source: Internet
Author: User

Knowledge Popularization:

1 normally, we use the explain plan for, set autotrace, and utlxplan methods to view the execution plans. They are all the execution plans generated by optimizer and do not fully conform to the execution paths of Oracle internal SQL statements.

2 v $ parent cursor placed in sqlarea, and SQL _id and address of SQL

3 v $ SQL corresponds to the SQL sub-cursor in v $ sqlarea. address and child_number represent the unique sub-cursor.

How to query the actual SQL Execution Plan of SQL statements in the database:

1 set autotrace on

If the statement returns a large number of rows, the results will be very large, which is a difficult choice in sqlplus.

Set autotrace traceonly -- the correct execution plan cannot be displayed each time, causing misleading SQL optimization.

2 querying v $ SQL _plan is the actual execution path, but it is difficult to read.

3. Use the following statement to query the actual SQL Execution path and format the execution path output.

Set linesize 400

Set pagesize 60

SELECT * from table (SELECT DBMS_XPLAN.DISPLAY_CURSOR ('a8tumy29tf0za ', '0') from dual );

-- The first one is SQL _id.

-- The second is child_number.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.