如何优化这条 sql

查看 43|回复 1
作者:fatyoung   
查询字段 a ,要求在 T1 表有数据,在 T2 表没数据,这两张表都有 a 的普通索引,两张表数据量大致相同
我的 sql 如下
select a from T1 where a not in (select a from T2)
请教大家,有优化的空间吗?如何优化?

select, SQL, from, 优化

liprais   
用 exists
select a from T1 where not exists (select 1 from T2 where t2.a = t1.a)
您需要登录后才可以回帖 登录 | 立即注册

返回顶部