ITPub博客

首页 > 应用开发 > IT综合 > not exists 与 not in的效率差异

not exists 与 not in的效率差异

原创 IT综合 作者:drgfml 时间:2011-12-04 21:01:24 0 删除 编辑
select *
from t_cs_personcust t
where (is_new = '001' or is_new = '011' or is_new = '101' or
is_new = '111')
and not exists (select distinct cust_id
from t_cs_personcust_app
where (is_new = '001' or is_new = '011' or
is_new = '101' or is_new = '111')
and message_no = '初始导入'
and cust_id = t.cust_id);
检索数据2796条,检索时间 3.516 秒

select *
from t_cs_personcust t
where (is_new = '001' or is_new = '011' or is_new = '101' or
is_new = '111')
and cust_id not in (select distinct cust_id
from t_cs_personcust_app
where (is_new = '001' or is_new = '011' or
is_new = '101' or is_new = '111')
and message_no = '初始导入');
检索数据2796条,检索时间 45.14 秒[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/96210/viewspace-1056687/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 关于outer join
请登录后发表评论 登录
全部评论
  • 博文量
    32
  • 访问量
    59160