- 最后登录
- 2014-4-1
- 在线时间
- 34 小时
- 威望
- 0
- 金钱
- 122
- 注册时间
- 2013-7-2
- 阅读权限
- 10
- 帖子
- 48
- 精华
- 0
- 积分
- 0
- UID
- 1154
|
5#
发表于 2013-9-2 10:47:24
采用刘大的建议采用复合索引,成效很明显,逻辑读与物理读有明显降低。- SQL>drop index xcxt_wh.INDEX_AJ_JJDJ0828_JBSJ
- SQL>drop index xcxt_wh.INDEX_AJ_JJDJ0828_SFYCLID
- SQL> create index xcxt_wh.INDEX_AJ_JJDJ0828_JBSJ on xcxt_wh.T_AJ_QQSJ_0828(JBSJ,SFYCLID)
- Index created.
- Elapsed: 00:00:39.22
- SQL> SELECT COUNT(1) as CT from xcxt_wh.T_AJ_QQSJ_0828 j where
- 2 j.jbsj >= to_Date('2013-08-01 00:00:00', 'yyyy-MM-dd hh24:mi:ss')
- 3 and j.jbsj <= to_Date('2013-08-10 23:59:59', 'yyyy-MM-dd hh24:mi:ss')
- 4 /
- CT
- ----------
- 95845
- Elapsed: 00:00:00.25
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 738637433
- --------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 8 | 282 (1)| 00:00:04 |
- | 1 | SORT AGGREGATE | | 1 | 8 | | |
- |* 2 | INDEX RANGE SCAN| INDEX_AJ_JJDJ0828_JBSJ | 94691 | 739K| 282 (1)| 00:00:04 |
- --------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 2 - access("J"."JBSJ">=TO_DATE(' 2013-08-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
- AND "J"."JBSJ"<=TO_DATE(' 2013-08-10 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
- Statistics
- ----------------------------------------------------------
- 1 recursive calls
- 0 db block gets
- 283 consistent gets
- 282 physical reads
- 0 redo size
- 518 bytes sent via SQL*Net to client
- 524 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
-
- SQL> SELECT count(1) from xcxt_wh.T_AJ_QQSJ_0828 j
- 2 where j.jbsj >= to_Date('2013-08-01 00:00:00', 'yyyy-MM-dd hh24:mi:ss')
- 3 and j.jbsj <= to_Date('2013-08-10 23:59:59', 'yyyy-MM-dd hh24:mi:ss')
- 4 and j.SFYCLID = '1'
- 5 /
- COUNT(1)
- ----------
- 89309
- Elapsed: 00:00:00.08
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 738637433
- --------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 10 | 282 (1)| 00:00:04 |
- | 1 | SORT AGGREGATE | | 1 | 10 | | |
- |* 2 | INDEX RANGE SCAN| INDEX_AJ_JJDJ0828_JBSJ | 93509 | 913K| 282 (1)| 00:00:04 |
- --------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 2 - access("J"."JBSJ">=TO_DATE(' 2013-08-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
- AND "J"."SFYCLID"='1' AND "J"."JBSJ"<=TO_DATE(' 2013-08-10 23:59:59', 'syyyy-mm-dd
- hh24:mi:ss'))
- filter("J"."SFYCLID"='1')
- Statistics
- ----------------------------------------------------------
- 1 recursive calls
- 0 db block gets
- 285 consistent gets
- 35 physical reads
- 0 redo size
- 524 bytes sent via SQL*Net to client
- 524 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
-
- SQL> SELECT count(1) from xcxt_wh.T_AJ_QQSJ_0828 j
- 2 where j.jbsj >= to_Date('2013-08-01 00:00:00', 'yyyy-MM-dd hh24:mi:ss')
- 3 and j.jbsj <= to_Date('2013-08-10 23:59:59', 'yyyy-MM-dd hh24:mi:ss')
- 4 and j.SFYCLID = '1'
- 5 and (j.jbdwid ='11010542000000' or j.cbdw = '11010542000000')
- 6 /
- COUNT(1)
- ----------
- 876
- Elapsed: 00:00:00.37
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 1223631081
- ----------------------------------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
- ----------------------------------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 28 | | 1053 (2)| 00:00:13 |
- | 1 | SORT AGGREGATE | | 1 | 28 | | | |
- | 2 | BITMAP CONVERSION COUNT | | 1161 | 32508 | | 1053 (2)| 00:00:13 |
- | 3 | BITMAP AND | | | | | | |
- | 4 | BITMAP OR | | | | | | |
- | 5 | BITMAP CONVERSION FROM ROWIDS| | | | | | |
- |* 6 | INDEX RANGE SCAN | INDEX_AJ_JJDJ0828_JBDWID | 93509 | | | 225 (1)| 00:00:03 |
- | 7 | BITMAP CONVERSION FROM ROWIDS| | | | | | |
- |* 8 | INDEX RANGE SCAN | INDEX_AJ_JJDJ0828_CBDW | 93509 | | | 4 (0)| 00:00:01 |
- | 9 | BITMAP CONVERSION FROM ROWIDS | | | | | | |
- | 10 | SORT ORDER BY | | | | 2984K| | |
- |* 11 | INDEX RANGE SCAN | INDEX_AJ_JJDJ0828_JBSJ | 93509 | | | 282 (1)| 00:00:04 |
- ----------------------------------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 6 - access("J"."JBDWID"='11010542000000')
- 8 - access("J"."CBDW"='11010542000000')
- 11 - access("J"."JBSJ">=TO_DATE(' 2013-08-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "J"."SFYCLID"='1' AND
- "J"."JBSJ"<=TO_DATE(' 2013-08-10 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
- filter("J"."SFYCLID"='1' AND "J"."JBSJ"<=TO_DATE(' 2013-08-10 23:59:59', 'syyyy-mm-dd hh24:mi:ss') AND
- "J"."JBSJ">=TO_DATE(' 2013-08-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
- Statistics
- ----------------------------------------------------------
- 1 recursive calls
- 0 db block gets
- 471 consistent gets
- 188 physical reads
- 0 redo size
- 523 bytes sent via SQL*Net to client
- 524 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 1 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
复制代码 |
|