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