Nested loops Join

Source: Internet
Author: User
Here is a description of how the nested loops (Nested Loops short nl) are connected.   Nested loops, as the name implies is a table as the starting point, the table all records to traverse another table of records, meet the conditions is to write the result set.   Www.2cto.com For example: select A.*, b * from EMP A, DEPT b where a.deptno = B.deptno; If the use of the EMP table as the starting point, the EMP table records are queried for the M bar, and then the M-record field Deptno value, and dept table of all Records deptno field values, if the Dept table has N Records.   Matching records are written to the result set if they match the criteria.   So in this association operation process, the operation of the number of records is: first emp table of M, followed by dept table N, but checked m times, the total number of records is m+m*n.   If you use the Dept table as the starting point to traverse the EMP table, then the total number of records is n+n*m. Starting from different connection methods, the cost is not the same.   The CBO will go to the youngest one. Here as the starting point of the table, the official terms refer to it as an external table, also called a driver table.

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.