Optimization of execution plans of Oracle nested loops

Source: Internet
Author: User
The two datasets processed by nested loop connections are called outerloop (driving data source, drivingrowsoulce) and innerloop (innerloop)

The two datasets processed by nested loop connection are called the External loop (namely, the driving data source, driving row soulce) and the internal loop (inner loop)

The two datasets processed by nested loop connection are called the External loop (that is, the driving data source, driving row soulce) and the internal loop (inner loop ). The External Loop is the left subnode, and the internal loop is the right subnode. 10 to 6. When the External Loop is executed once, the internal loop needs to be executed once for each record returned by the External Loop.

Nested loop connections have the following features:

The left subnode (External Loop) of the port is executed only once, while the right subnode (internal loop) is generally executed many times.

The first record of the result set can be returned before all data is processed.

The interface can effectively use indexes to process restrictions and connection conditions.

Ports support all types of connections.

Two-table join

The following is a simple execution plan for nested loop join of two tables. It also describes how to use the prompt 1 eading and use_n1 to force nested loop connections. The Leading prompt requires that the table tl be accessed first, that is, it specifies which table is used as the External Loop table. The use_nl prompt specifies the connection method used to connect the data returned by an internal loop (Table t2) to table t1. Note that the usenl prompt does not reference table t1.

SELECT/* + leading (t1) use_nl (t2) full (t1) full (t2 )*/*

FROM t1, t2 WHERE tl. id = t2.id AND tl. n = 19

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.