order by 列加索引
来源:互联网 发布:tensorflow theano 编辑:程序博客网 时间:2024/06/11 01:59
create table t_order_tb asselect * from dba_objects ; select * from t_order_tb t where t.object_id > 2 ;select * from t_order_tb t where t.object_id > 2 order by t.object_id;create index ind_order_object_id on t_order_tb(object_id) ;select * from t_order_tb t where t.object_id > 2 order by t.object_id;select t.object_id from t_order_tb t where t.object_id > 2 order by t.object_id;SQL> set autotrace traceonly;SQL> select * from t_order_tb t where t.object_id > 2 ;已选择50628行。已用时间: 00: 00: 02.25执行计划----------------------------------------------------------Plan hash value: 2653850918--------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |--------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 41858 | 7235K| 162 (3)| 00:00:02 ||* 1 | TABLE ACCESS FULL| T_ORDER_TB | 41858 | 7235K| 162 (3)| 00:00:02 |--------------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 1 - filter("T"."OBJECT_ID">2)Note----- - dynamic sampling used for this statement统计信息---------------------------------------------------------- 4 recursive calls 0 db block gets 4080 consistent gets 399 physical reads 0 redo size 2453530 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50628 rows processedSQL>SQL> select * from t_order_tb t where t.object_id > 2 order by t.object_id;已选择50628行。已用时间: 00: 00: 01.50执行计划----------------------------------------------------------Plan hash value: 3469110092-----------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |-----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 41858 | 7235K| | 1793 (1)| 00:00:22 || 1 | SORT ORDER BY | | 41858 | 7235K| 16M| 1793 (1)| 00:00:22 ||* 2 | TABLE ACCESS FULL| T_ORDER_TB | 41858 | 7235K| | 162 (3)| 00:00:02 |-----------------------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 2 - filter("T"."OBJECT_ID">2)Note----- - dynamic sampling used for this statement统计信息---------------------------------------------------------- 4 recursive calls 0 db block gets 758 consistent gets 0 physical reads 0 redo size 2447912 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 50628 rows processedSQL> select * from t_order_tb t where t.object_id > 2 order by t.object_id;已选择50628行。已用时间: 00: 00: 01.68执行计划----------------------------------------------------------Plan hash value: 780952064---------------------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |---------------------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 41858 | 7235K| 876 (1)| 00:00:11 || 1 | TABLE ACCESS BY INDEX ROWID| T_ORDER_TB | 41858 | 7235K| 876 (1)| 00:00:11 ||* 2 | INDEX RANGE SCAN | IND_ORDER_OBJECT_ID | 41858 | | 126 (2)| 00:00:02 |---------------------------------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 2 - access("T"."OBJECT_ID">2) filter("T"."OBJECT_ID">2)Note----- - dynamic sampling used for this statement统计信息---------------------------------------------------------- 9 recursive calls 0 db block gets 7609 consistent gets 112 physical reads 0 redo size 5439440 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50628 rows processedSQL>SQL> select t.object_id from t_order_tb t where t.object_id > 2 order by t.object_id;已选择50628行。已用时间: 00: 00: 00.48执行计划----------------------------------------------------------Plan hash value: 957369183----------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 41858 | 531K| 126 (2)| 00:00:02 ||* 1 | INDEX RANGE SCAN| IND_ORDER_OBJECT_ID | 41858 | 531K| 126 (2)| 00:00:02 |----------------------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 1 - access("T"."OBJECT_ID">2) filter("T"."OBJECT_ID">2)Note----- - dynamic sampling used for this statement统计信息---------------------------------------------------------- 7 recursive calls 0 db block gets 3546 consistent gets 0 physical reads 0 redo size 732819 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50628 rows processed
1 0
- order by 列加索引
- Order by 字段加在索引何处
- 聚类索引要不要加 order by
- order by与索引
- ORACLE ORDER BY 索引
- order by与索引
- order by与索引
- order by与索引
- order by与索引
- order by 索引失效
- order by 需要索引
- mysql的order by与where加了索引与没有加索引的结果集区别
- order by 加参数问题
- MySQL Order By索引优化
- MySQL Order By索引优化
- MySQL Order By索引优化
- MySQL Order By索引优化
- MySQL Order By索引优化
- json解析,jquery解析遍历json
- hbase编程指南
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (
- OSG OSGearth vs2010编译
- Sharpssh连接linux上传下载文件
- order by 列加索引
- MySQL中文全文检索demoSQL
- Iptables防火墙使用
- Parallel Computing Toolbox(PCT)
- Android知识梳理之BroadcastReceiver整理
- 查看android sqlite数据库常用操作
- Android中通过EventBus传递消息数据
- # Java面试复习准备
- XMLHttpRequest实现终止请求和超时