sql> set autot trace
sql> select owner, object_name from
2 (select a.*, rownum as rn from
3 (select owner, object_name, rowid from t_test1 order by owner, object_id) a
4 where rownum <= 20)
5 where rn >= 11;
10 rows selected.
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=253 Card=20 Bytes=940)
1 0 VIEW (Cost=253 Card=20 Bytes=940)
2 1 COUNT (STOPKEY)
3 2 VIEW (Cost=253 Card=30670 Bytes=1042780)
4 3 SORT (ORDER BY STOPKEY) (Cost=253 Card=30670 Bytes=1196130)
5 4 table ACCESS (FULL) OF 'T_TEST1' (Cost=42 Card=306
70 Bytes=1196130)
sql> select owner, object_name from
2 (select a.*, rownum as rn from
3 (select owner, object_name, rowid from t_test1 order by owner, object_id) a
4 where rownum <= 20)
5 where rn >= 11;
10 rows selected.
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=253 Card=20 Bytes=940)
1 0 VIEW (Cost=253 Card=20 Bytes=940)
2 1 COUNT (STOPKEY)
3 2 VIEW (Cost=253 Card=30670 Bytes=1042780)
4 3 SORT (ORDER BY STOPKEY) (Cost=253 Card=30670 Bytes=1196130)
5 4 table ACCESS (FULL) OF 'T_TEST1' (Cost=42 Card=306
70 Bytes=1196130)
本文展示了一个具体的SQL查询案例,其中包括对特定表T_TEST1的分页查询语句及对应的执行计划。通过分析,我们可以了解数据库如何优化SQL执行效率。
1038

被折叠的 条评论
为什么被折叠?



