还有,有时还会报超时。 select * from (select * from tgmy.c_hwda a where a.hwid not in (select hwid from tgmy.ht_d_hwfp) ) b where Length(trim(b.hwcode))>=8 and substr(b.hwcode,1,2) >= '01' and substr(b.hwname,1,1) <> 'X' order by substr(b.hwcode,1,2),substr(b.hwcode,8,1) ,substr(b.hwcode,1,7) desc 如果这么改,速度就不会慢了。但是也达不到我要的效果了。 not in 和 not existsnot in 要进行全表扫描 而not exists 不会 可时实际使用,执行时间是一样的啊。 有优化的方法吗
不是,现在只有一个人用,是不是和设置有关
select * from
(select * from tgmy.c_hwda a
where a.hwid not in (select hwid from tgmy.ht_d_hwfp) ) b
where
Length(trim(b.hwcode))>=8 and substr(b.hwcode,1,2) >= '01' and substr(b.hwname,1,1) <> 'X'
order by substr(b.hwcode,1,2),substr(b.hwcode,8,1) ,substr(b.hwcode,1,7) desc
如果这么改,速度就不会慢了。但是也达不到我要的效果了。
not in 和 not existsnot in 要进行全表扫描
而not exists 不会
可时实际使用,执行时间是一样的啊。
有优化的方法吗