access查询优化

一个zirancun 14万数据量,一个 zirancuntd 19万数据,这两个  zirancuntd.distid 与zirancun.id进行关联,查询 zirancuntd.distid不存在与zirancun中

1.SELECT id from zirancuntd where (select id from zirancun where id=zirancuntd.distid) is null

2.select id from zirancuntd  where distid not in(select id from zirancun)

这两条语句执行效率差别很大

第一个语句几秒钟就查询出来,但是第二条语句却一个小时也没有出来,起初以为没有设置这两个表的id,查询没有优化,但是后来设置了主键后,两个语句的查询效果依旧很大。不知道为什么?记录一下~

 

posted on 2015-06-25 13:24 Kepton 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/kepton/p/4599753.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值