Oracle Execution Plan -- Operation

本文深入探讨了Oracle中HashGroupBy和SortJoin技术的原理与应用,包括HashGroupBy的默认分组机制、SortJoin作为SortMergeJoin的第一步如何确保分发源有序,以及MergeJoin的不同类型如笛卡尔积式的MergeJoin。此外,还阐述了BufferSort的作用,即某些数据的缓存以供重复访问,而实际上并无排序发生。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hash Group By

Starting with 10g, Oracle introduced “Hash Group By” as the default grouping by mechanism.


Oracle employs a hash algorithm to calculate the hash value for each row based on the GROUP BY columns. This allows rows with identical column values (and hence identical hash values) to be "brought together" without performing a full sort. And then the aggregation is performed upon each group. The hash group by does not guarantee the order of the output, one should use “order by” clause to ensure the order.

Sort Join

Sort join is the first operation of the “Sort Merge Join”. Before Oracle joins two row sources, both row sources have to be in order. If required, Oracle does a sort. The name is a bit misleading. All it does is a sort on the join key.

The “Sort Merge Join” consists of two steps:

  •     Sort join operation. Both the inputs are sorted on the join key.
  •     Merge join operation. The sorted lists are merged.

Merge Join Cartesian

笛卡尔积式的Merge Join. 只有在两个结果集都很小时,该操作是合理的。 看到它,请检查你的SQL,是否漏了join.

Buffer Sort

Oracle将某些数据放入缓存,以便重复访问。 其实没有排序发生!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值