關於分割槽表中的全partition掃描問題

tolywang發表於2010-04-01
Oracle 10.2.0.4 ,  3 nodes RAC , Linux AS 5.3  64bit .  


具體執行計劃見圖片,   wip_d_sn_detail 是一個分割槽表 ,半年一個分割槽,其中 20100101 ~ 20100701 是第三個分割槽。
查詢發現partition 3 的總資料量是 4100多萬,  報表需要查詢的時間段(一天) 資料量只有 52 萬 。  



SELECT ROWNUM AS ID, plant_code, serial_number, work_order, batch_no,
model_name, product_line,
TO_CHAR (in_station_time, 'YYYY/MM/DD HH24:MI:SS') AS in_station_time,
op_no
FROM wip_d_sn_detail
WHERE ck_flag = 'N'
AND work_group ='KIT1'
AND plant_code IN ('MI02', 'MI03', 'MI04')
AND product_line ='J302'
AND in_station_time >= TO_DATE ('20100322 14:12:00', 'YYYYMMDD HH24:MI:SS')
AND in_station_time < TO_DATE ('20100323 14:12:00', 'YYYYMMDD HH24:MI:SS')








SELECT /*INDEX(wip_d_sn_detail,IDX_WIP_D_SN_DETAIL_TIME)*/  
ROWNUM AS ID, plant_code, serial_number, work_order, batch_no,
model_name, product_line,
TO_CHAR (in_station_time, 'YYYY/MM/DD HH24:MI:SS') AS in_station_time,
op_no
FROM wip_d_sn_detail
WHERE ck_flag = 'N'
AND work_group ='KIT1'
AND plant_code IN ('MI02', 'MI03', 'MI04')
AND product_line ='J302'
AND in_station_time >= TO_DATE ('20100322 14:12:00', 'YYYYMMDD HH24:MI:SS')
AND in_station_time < TO_DATE ('20100323 14:12:00', 'YYYYMMDD HH24:MI:SS')






查詢partition 3 的總資料量是 4133萬 (說明: 這裡是半年設定一個partition)。

SELECT
count(1)
FROM wip_d_sn_detail
WHERE in_station_time >= TO_DATE ('20100101 00:00:00', 'YYYYMMDD HH24:MI:SS')
AND in_station_time < TO_DATE ('20100701 00:00:00', 'YYYYMMDD HH24:MI:SS') ;






查詢partition 3 中 0322~0323 這一天內的資料量是 52 萬 。

SELECT count(1)
FROM wip_d_sn_detail
WHERE  in_station_time >= TO_DATE ('20100322 14:12:00', 'YYYYMMDD HH24:MI:SS')
AND in_station_time < TO_DATE ('20100323 14:12:00', 'YYYYMMDD HH24:MI:SS')









關於分割槽表中的全partition掃描問題
addhint.jpg

關於分割槽表中的全partition掃描問題
no-hint.jpg

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-659776/,如需轉載,請註明出處,否則將追究法律責任。

相關文章