DELETE FROM a WHERE a.mobile NOT IN ( SELECT DISTINCT mobile FROM b WHERE mobile IS NOT NULL )
比如这样的一条 sql 逻辑 ,not in
数据量很大 删了好久
1
heaton_nobu 2020-03-19 15:49:33 +08:00
1. NOT EXISTS
2. LEFT JOIN |
2
ganbuliao 2020-03-19 16:00:36 +08:00
子查询当然慢了 和 not in 无关
|
3
hammer86 2020-03-19 16:04:13 +08:00 via iPhone
not in 不走索引 所以慢
|
4
sagaxu 2020-03-19 16:32:07 +08:00 via Android 1
|
5
shangfabao 2020-03-19 16:34:32 +08:00
left join * b
where b.* is null |
6
alya 2020-03-19 16:53:29 +08:00
left semi join
|
7
25OHd2qObJmJ6P10 2020-03-19 17:21:23 +08:00
IS NOT NULL 和 NOT IN 都不走索引,能不慢么,楼上都对
|