select * from SmsLocalData t1
where exists (select 1 from SmsLocalData t2 where t1.ID=t2.ID order by Time desc, ID desc limit 0,10000) and IsDel=0
这句话的运行结果是,limit 0, 10000似乎没有做。
问题出在哪里?
------解决方案--------------------
在TIME、ID中建立索引
select * from SmsLocalData t1 order by Time desc, ID desc limit 0,10000
需要多长时间
------解决方案--------------------
select * from SmsLocalData t1
inner join (select 1IDfrom SmsLocalData t2 order by Time desc, ID desc limit 0,10000) t3
on where t1.ID=t3.ID and IsDel=0