同之前聊过的 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 |