Summarization of three kinds of table join algorithms in Oracle

Source: Internet
Author: User
Tags hash join joins memory usage sort
Oracle has three kinds of table connectivity technologies, namely, nested joins, merge joins, and Hash joins. The following is a detailed analysis of the three kinds of table connection algorithm, the need for friends can refer to the

1. Nested loop joins (NESTED Loop join)
A nested connection divides the data set to be processed into an outer loop (a driving data source) and an inner loop (driven data source), which executes only once (executes first), and the number of times the loop executes is equal to the number of data sets performed outside the loop.

The advantage of this connection is that there is very little memory usage.
This connection is efficient if the drive data source is limited and the driven table has the appropriate index on the connection column.
This type of connection is common to OLTP systems.

2. Sort merge joins (sort merge Join)
As the name suggests, a sort merge is the first to sort the connected datasets, and then merge, which is done roughly by sorting the dataset of Table A, sorting the results in workspace A, sorting the dataset in table B, and sorting the results in Workspace b , and finally merge the data in workspace A and B.

For this connection method, the cost of sorting is very large, and the memory parameters associated with the sort workspace are: Sort_area_size and sort_area_retained_size, all in the PGA.

3. Hash joins (hash join)
the two datasets processed by the hash join are called construction input (build input) and probe input (probe input), each row of the constructed input is used to construct the hash table, and each row of the probe input detects the hash table to find the records that meet the join conditions.
The smaller table as the construction input, the larger table as the probe input, so that the hash connection efficiency is relatively high, in the execution plan, the smaller input table in front, the larger probe table in the back.
A hash connection can only be performed under the condition of an equal connection.
the memory parameters associated with the hash table workspace are: Hash_area_size, also in the PGA.

Related Article

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.