Local prefixed index和Local nonprefixed index对select语句的(5)

点评:先是对LI_IDX_04索引做PARTITIONRANGE ITERATOR 的INDEX RANGE SCAN,access(访问)和filter(过滤)全部在索引中完成,不需要回表,consistent gets只有43,代价极小。

4.5 场景五:global index(全局索引)

SQL> select /*+ index(t li_idx_05)*/ * from tivoli.li_db_session_t t where t.allsess=28 and t.dbname='COSTDB' and t.timstap >to_date('2011-01-01','yyyy-mm-dd') and t.timstap < to_date('2011-01-20','yyyy-mm-dd') and t.activess=4;

498 rows selected.

Execution Plan

----------------------------------------------------------

Plan hash value: 1711410678

------------------------------------------------------------------------------

| Id  | Operation        | Name      | Rows  | Bytes | Cost (%CPU)| Time    |

------------------------------------------------------------------------------

|  0 | SELECT STATEMENT |          |    10 |  200 |    3  (0)| 00:00:01 |

|*  1 |  INDEX RANGE SCAN| LI_IDX_05 |    10 |  200 |    3  (0)| 00:00:01 |

------------------------------------------------------------------------------

Predicate Information (identified by operation id):

---------------------------------------------------

1 - access("T"."DBNAME"='COSTDB' AND "T"."ALLSESS"=28 AND

"T"."TIMSTAP">TO_DATE(' 2011-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss')

AND "T"."ACTIVESS"=4 AND "T"."TIMSTAP"<TO_DATE(' 2011-01-20 00:00:00',

'syyyy-mm-dd hh24:mi:ss'))

filter("T"."ACTIVESS"=4)

Statistics

----------------------------------------------------------

1  recursive calls

0  db block gets

41  consistent gets

6  physical reads

0  redo size

9997  bytes sent via SQL*Net to client

886  bytes received via SQL*Net from client

35  SQL*Net roundtrips to/from client

0  sorts (memory)

0  sorts (disk)

498  rows processed

 

点评:先是对LI_IDX_05索引做PARTITIONRANGE ITERATOR 的INDEX RANGE SCAN,access(访问)和filter(过滤)全部在索引中完成,不需要回表,consistent gets只有41,五种不同类型应用中,代价最小。

4.6 场景六:where条件中不带分区列,但是使用不含分区列的LOCAL-NON_PREFIXED索引

SQL> select /*+ index(t li_idx_03)*/ * from tivoli.li_db_session_t t where t.allsess=28 and t.dbname='COSTDB' and t.activess=4;

--上面语句,where条件中不含表的分区列

2346 rows selected.

Execution Plan

----------------------------------------------------------

Plan hash value: 1367932018

----------------------------------------------------------------------------------------------------------------------

| Id  | Operation                          | Name            | Rows  | Bytes | Cost (%CPU)| Time    | Pstart| Pstop |

----------------------------------------------------------------------------------------------------------------------

|  0 | SELECT STATEMENT                  |                |  136 |  2720 |  134  (0)| 00:00:02 |      |      |

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1469c68f5f3613b1397260adc2dc2026.html