- 最后登录
- 2019-8-5
- 在线时间
- 74 小时
- 威望
- 51
- 金钱
- 703
- 注册时间
- 2012-3-1
- 阅读权限
- 50
- 帖子
- 94
- 精华
- 1
- 积分
- 51
- UID
- 271
|
1#
发表于 2012-3-9 11:04:51
|
查看: 6069 |
回复: 8
select a.so_nbr,
a.busi_code,
a.serv_id,
a.so_region_code,
a.so_county_code,
a.so_org_id,
a.op_id,
a.so_date,
to_char(decode(a.isnormal, 2, a.rso_nbr, '')) rso_nbr,
a.remark,
b.phone_id,
a.cust_id,
(select cust_name
from zk.cm_customer
where cust_id = a.cust_id
and rownum <= 1) cust_name
from zk.cm_busi_201202 a, zk.cm_user b
where a.serv_id = b.serv_id(+)
and (a.busi_code < 100 or a.busi_code in (2403, 2415))
and a.so_date >= to_date('20120211000000', 'yyyymmddhh24miss')
and a.so_date <= to_date('20120229235959', 'yyyymmddhh24miss')
and a.so_region_code in (771)
and a.so_county_code in
(7101, 7102, 7103, 7104, 7105, 7107, 7108, 7114, 7116, 7117, 7118, 7119, 7120)
and exists
(select 1 from zk.cm_busi_promo_201202 where so_nbr = a.so_nbr)
----------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Pstart| Pstop |
----------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 6448 | 1397K| 4476K (2)| | |
|* 1 | COUNT STOPKEY | | | | | | |
| 2 | TABLE ACCESS BY GLOBAL INDEX ROWID| CM_CUSTOMER | 1 | 17 | 4 (25)| ROWID | ROW L |
|* 3 | INDEX UNIQUE SCAN | PK_CM_CUSTOMER | 1 | | 3 (34)| | |
| 4 | NESTED LOOPS OUTER | | 6448 | 1397K| 4476K (2)| | |
| 5 | NESTED LOOPS SEMI | | 6448 | 1278K| 4463K (2)| | |
|* 6 | TABLE ACCESS BY INDEX ROWID | CM_BUSI_201202 | 6448 | 1215K| 4450K (2)| | |
|* 7 | INDEX RANGE SCAN | IDX_BUSI_SODATE_201202 | 25M| | 209K (3)| | |
| 8 | VIEW | CM_BUSI_PROMO_201202 | 6241K| 59M| | | |
| 9 | UNION-ALL PARTITION | | | | | | |
|* 10 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0770201202 | 4 | 40 | 4 (25)| | |
|* 11 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0771201202 | 4 | 40 | 4 (25)| | |
|* 12 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0772201202 | 6 | 60 | 4 (25)| | |
|* 13 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0773201202 | 13 | 130 | 4 (25)| | |
|* 14 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0774201202 | 3 | 30 | 4 (25)| | |
|* 15 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0775201202 | 5 | 50 | 4 (25)| | |
|* 16 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0776201202 | 5 | 50 | 4 (25)| | |
|* 17 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0777201202 | 12 | 120 | 4 (25)| | |
|* 18 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0778201202 | 5 | 50 | 4 (25)| | |
|* 19 | INDEX RANGE SCAN | IDX_CM_PROMO_SO_NBR_0779201202 | 3 | 30 | 4 (25)| | |
| 20 | TABLE ACCESS BY GLOBAL INDEX ROWID| CM_USER | 1 | 19 | 3 (34)| ROWID | ROW L |
|* 21 | INDEX RANGE SCAN | PK_ZK_CM_USER | 1 | | 2 (50)| | |
----------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(ROWNUM<=1)
3 - access("CM_CUSTOMER"."CUST_ID"=:B1)
6 - filter("SYS_ALIAS_1"."SO_REGION_CODE"=771 AND ("SYS_ALIAS_1"."BUSI_CODE"<100 OR "SYS_ALIAS_1"."BUSI_CODE"=2403 OR
"SYS_ALIAS_1"."BUSI_CODE"=2415) AND ("SYS_ALIAS_1"."SO_COUNTY_CODE"=7101 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7102 OR
"SYS_ALIAS_1"."SO_COUNTY_CODE"=7103 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7104 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7105 OR
"SYS_ALIAS_1"."SO_COUNTY_CODE"=7107 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7108 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7114 OR
"SYS_ALIAS_1"."SO_COUNTY_CODE"=7116 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7117 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7118 OR
"SYS_ALIAS_1"."SO_COUNTY_CODE"=7119 OR "SYS_ALIAS_1"."SO_COUNTY_CODE"=7120))
7 - access("SYS_ALIAS_1"."SO_DATE">=TO_DATE('2012-02-11 00:00:00', 'yyyy-mm-dd hh24:mi:ss') AND
"SYS_ALIAS_1"."SO_DATE"<=TO_DATE('2012-02-29 23:59:59', 'yyyy-mm-dd hh24:mi:ss'))
10 - access("CM_BUSI_PROMO_0770201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
11 - access("CM_BUSI_PROMO_0771201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
12 - access("CM_BUSI_PROMO_0772201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
13 - access("CM_BUSI_PROMO_0773201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
14 - access("CM_BUSI_PROMO_0774201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
15 - access("CM_BUSI_PROMO_0775201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
16 - access("CM_BUSI_PROMO_0776201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
17 - access("CM_BUSI_PROMO_0777201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
18 - access("CM_BUSI_PROMO_0778201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
19 - access("CM_BUSI_PROMO_0779201202"."SO_NBR"="SYS_ALIAS_1"."SO_NBR")
21 - access("SYS_ALIAS_1"."SERV_ID"="B"."SERV_ID"(+))
---Oracle9i Enterprise Edition Release 9.2.0.8.0
----zk.cm_busi_201202 4千万
---语句返回50几万
这个语句如何优化呢?? |
|