选择distinct或从子查询中选择distinct

时间:2015-08-25 16:08:35

标签: oracle distinct

哪个优于下面两个查询的性能?
不同之处在于第一个查询直接使用distinct,第二个查询将第一个查询作为内部查询(记录已经过滤在分明之前) (这是神谕)

select distinct t1.f1, t2.f2
from t1, t2
where ...

select distinct f1, f2
from
select *
from t1, t2
where ...

1 个答案:

答案 0 :(得分:0)

如果子查询表达相同的逻辑,那么它们是相同的。子查询将通过优化器中的转换来消除。