- 最后登录
- 2012-6-24
- 在线时间
- 17 小时
- 威望
- 58
- 金钱
- 390
- 注册时间
- 2012-4-23
- 阅读权限
- 50
- 帖子
- 23
- 精华
- 1
- 积分
- 58
- UID
- 384
|
1#
发表于 2012-4-23 23:07:14
|
查看: 7111 |
回复: 10
SELECT
M.STND_CITY_ID,
M.CITY_NME,
M.COUNTY_NME,
M.STATE_CDE,
M.STATE_NME,
M.CNTRY_CDE,
M.CNTRY_NME
FROM CS2_MASTER_CITY M, CARRIER_OFF_CONTROL_CITY C, BOOKING_OFFICE B
WHERE C.STND_CITY_ID = M.STND_CITY_ID
AND C.OFFICE_ID = B.BOOKING_OFFICE_ID
AND B.SERVICE_PROVIDER_ID =27
AND UPPER(M.CITY_NME) LIKE '%';
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
|* 1 | HASH JOIN | | 1 | 39097 | 6973 |00:00:05.82 | 29202 | 28380 |
|* 2 | HASH JOIN | | 1 | 38703 | 6973 |00:00:00.01 | 378 | 371 |
|* 3 | VIEW | index$_join$_003 | 1 | 79 | 105 |00:00:00.01 | 4 | 0 |
|* 4 | HASH JOIN | | 1 | | 105 |00:00:00.01 | 4 | 0 |
|* 5 | INDEX RANGE SCAN | BOOKING_OFFICE_IDX2 | 1 | 79 | 105 |00:00:00.01 | 1 | 0 |
| 6 | INDEX FAST FULL SCAN| BOOKING_OFFICE_PK | 1 | 79 | 269 |00:00:00.01 | 3 | 0 |
| 7 | TABLE ACCESS FULL | CARRIER_OFF_CONTROL_CITY | 1 | 39061 | 39078 |00:00:00.79 | 374 | 371 |
|* 8 | TABLE ACCESS FULL | CS2_MASTER_CITY | 1 | 2267K| 2269K|00:00:13.63 | 28824 | 28009 |
------------------------------------------------------------------------------------------------------------------------
实际返回6973行,但是CBO算出来39097行,其实加hit /*+ use_nl(B,C) use_nl(C,M) */ 强制CBO走NEST LOOP,CR 和CPU TIME 都要优于上面的HASH JOIN(详细请看SQL TRACE 文件),但是就是不清楚为什么CBO会算错,对表也都做了分析。作了SQL TRACE和10053都没看出root cause。
附近有SQL TRACE 原始文件和PKOCRF 文件,以及10053文件。 |
|