Select 与子查询不同或 select 不同
Select distinct or select distinct from subquery
在性能方面哪个比下面两个查询更好?
不同的是第一个查询直接使用distinct,第二个查询以第一个查询为内查询(记录已经在 distinct 之前过滤了)
(这是甲骨文)
select distinct t1.f1, t2.f2
from t1, t2
where ...
select distinct f1, f2
from
select *
from t1, t2
where ...
如果子查询表达的逻辑相同,则它们是相同的。子查询将被优化器中的转换消除。
在性能方面哪个比下面两个查询更好?
不同的是第一个查询直接使用distinct,第二个查询以第一个查询为内查询(记录已经在 distinct 之前过滤了)
(这是甲骨文)
select distinct t1.f1, t2.f2
from t1, t2
where ...
select distinct f1, f2
from
select *
from t1, t2
where ...
如果子查询表达的逻辑相同,则它们是相同的。子查询将被优化器中的转换消除。