ORACLE CBO 的 SQL 自动转换(Cost Based Transformations)之六

本文介绍了ORACLE CBO中关于Distict配置的最优机能,称为Distinct Placement。通过一个Test case展示了Distinct Placement在执行计划中的表现,涉及到内部转换的试图VW_DTP_*.关闭该功能的设置是 '_optimizer_distinct_placement' 设置为false。
摘要由CSDN通过智能技术生成

同之前聊过的 Group By 配置最优机能同等的,还有 Distinct 配置最优机能(Distinct Placement)

Distinct 配置最优机能(Distinct Placement)

还是用下面的 Test case 进行简单的演示,说明一下 Distinct Placement 动作时执行计划的样子。

drop table t1 purge;
drop table t2 purge;
create table t1(c1 number, c2 number not null);
create table t2(c1 number, c2 number not null);
insert into t1 values (1,1);
insert into t1 values (1,2);
insert into t1 values (2,2);
insert into t2 values (1,2);
commit;

SQL> SQL> select /*+ place_distinct(t2) */
      distinct t1.c2, t2.c2
from t1, t2
where t1.c1 = t2.c1;  2    3    4

        C2         C2
---------- ----------
         1          2
         2          2


Execution Plan
----------------------------------------------------------
Plan hash value: 107983552

-----------------------------------------------------------------------------------------
| Id  | Operation             | Name            | Rows  | Bytes |
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值