select * from (
select t_tmp_a.*, rownum t_tmp_id from (
select t.*, i.counts
from table1 t, (select id, count(id) counts from table2 group by id) i
where t.id=i.id and t.kindid in (0,1,3) order by t.id desc
) t_tmp_a where rownum <= 20) t_tmp_b where t_tmp_id >= 11;
表1和表2中每个表超过2万个数据,当执行这个查询需要18S,在此之前的查询执行在大约7秒就要计算总数的需要,所以它花费超过25秒以上,任何想要优化它吗?Oracle数据寻呼优化
Probablly是http://dba.stackexchange.com/问题。 – hkutluay
@Mat,对不起,我有这个问题发布到该网站。 – user1744739
@Mat感谢您的警告..从现在开始我不知道旗帜功能。 – hkutluay