暂无图片
哪种连接条件,是可能走出HASH JOIN的
我来答
分享
超越无限D
2023-01-03
哪种连接条件,是可能走出HASH JOIN的

哪种连接条件,是可能走出HASH JOIN的?

我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
DarkAthena

这题不太好回,因为只要有连接,都有办法让它走hash join ,大不了强制hint 。
无论是基于RBO还是CBO,连接条件的本身都不是是否会走hash join的决定因素,比如下面这个例子

create table test_aa as select * from dba_objects; create table test_bb as select * from dba_objects; ----hash join select * from test_aa a, test_bb b where a.object_id = b.object_id ; ----hash join select * from test_aa a, test_bb b where a.object_id = b.object_id and a.object_id=1; create unique index xxxxxx on TEST_AA (object_id); ----hash join select * from test_aa a, test_bb b where a.object_id = b.object_id ; --NESTED LOOPS select * from test_aa a, test_bb b where a.object_id = b.object_id and a.object_id=1;

sql没变,就建了个索引,连接方式就变了;
而且同样的连接条件,只是过滤条件不一样,连接方式也可能会不一样;
甚至还有可能,连接条件和过滤条件一样,但由于表的数据量或返回的数据量不一样,采用的连接方式也会不一样。

暂无图片 评论
暂无图片 有用 0
暂无图片
愤怒的蜗牛
2023-01-06
回答的真是详细,学习了。。。。。
伊伊相印

一般是等值连接。。。。。。。。。。。。。。

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏