table1 有两个Index
index1 for pri_key
index2 for colID
select * from table1 order by pri_key ----so faster
select * from table2 order by colID 和不建索引效果一样
index2没起作用?????
why
100分不够,只管开口要。
...全文
3825打赏收藏
我建了索引,却不起作用?why???
table1 有两个Index index1 for pri_key index2 for colID select * from table1 order by pri_key ----so faster select * from table2 order by colID 和不建索引效果一样 index2没起作用????? why 100分不够,只管开口要。
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TEST'
2 1 INDEX (FULL SCAN) OF 'PK_TEST' (UNIQUE)
使用到主键的索引
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
826 bytes sent via SQL*Net to client
424 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10 rows processed
more@xgis.more>select id,val from test order by val;
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TEST'
2 1 INDEX (FULL SCAN) OF 'SYS_C002419' (UNIQUE)
唯一非空索引(ddd)用到
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
943 bytes sent via SQL*Net to client
424 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10 rows processed