無法收集統計資訊,怎樣優化SQL。

2022-06-12 14:39:10 字數 4548 閱讀 7917

特殊情況如下

客戶的統計資訊是固定的,沒辦法收集統計資訊 。

sql profile 是最後考慮方案,因為同樣寫法sql 比較多,幾十條。

parallle 並行客戶一般不考慮接受,oltp 系統。

最好使用hint .

無法收集統計資訊,怎樣優化sql。

首先在dev 環境收集統計資訊,通過sqlhc ,收取結果。

其次使用收集資訊的outline ,來代入,調優

結果如下:

select 

/*+begin_outline_data

ignore_optim_embedded_hints

optimizer_features_enable('11.2.0.4')

db_version('11.2.0.4')

all_rows

outline_leaf(@"sel$7286615e")

merge(@"sel$5")

outline_leaf(@"sel$335dd26a")

merge(@"sel$3")

outline_leaf(@"sel$e9ce8d49")

merge(@"sel$07c48a2d")

outline_leaf(@"sel$b584fdd1")

merge(@"sel$29f99543")

outline_leaf(@"sel$201a8568")

merge(@"sel$10")

merge(@"sel$11")

merge(@"sel$12")

merge(@"sel$13")

merge(@"sel$6")

merge(@"sel$7")

merge(@"sel$8")

merge(@"sel$9")

outline(@"sel$4")

outline(@"sel$5")

outline(@"sel$2")

outline(@"sel$3")

outline(@"sel$17")

outline(@"sel$07c48a2d")

merge(@"sel$19")

outline(@"sel$14")

outline(@"sel$29f99543")

merge(@"sel$16")

outline(@"sel$1")

outline(@"sel$10")

outline(@"sel$11")

outline(@"sel$12")

outline(@"sel$13")

outline(@"sel$6")

outline(@"sel$7")

outline(@"sel$8")

outline(@"sel$9")

outline(@"sel$18")

outline(@"sel$19")

outline(@"sel$15")

outline(@"sel$16")

full(@"sel$201a8568" "container"@"sel$6")

index_rs_asc(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$10" ("locn_gp_access_ctrl_gp_member"."ls_level_1"

"locn_gp_access_ctrl_gp_member"."ls_level_2" "locn_gp_access_ctrl_gp_member"."ls_level_3" "locn_gp_access_ctrl_gp_member"."ls_level_4"))

full(@"sel$201a8568" "shipment"@"sel$7")

full(@"sel$201a8568" "shipment_instruction"@"sel$8")

no_access(@"sel$201a8568" "rfr"@"sel$1")

full(@"sel$201a8568" "location_space"@"sel$13")

index_ffs(@"sel$201a8568" "empty_pool_container"@"sel$9" ("empty_pool_container"."empty_pool_code" "empty_pool_container"."cntr_id"))

full(@"sel$201a8568" "cntr_damage_dtl"@"sel$12")

full(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$11")

leading(@"sel$201a8568" "container"@"sel$6" "locn_gp_access_ctrl_gp_member"@"sel$10" "shipment"@"sel$7" "shipment_instruction"@"sel$8"

"rfr"@"sel$1" "location_space"@"sel$13" "empty_pool_container"@"sel$9" "cntr_damage_dtl"@"sel$12" "locn_gp_access_ctrl_gp_member"@"sel$11")

use_hash(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$10")

use_hash(@"sel$201a8568" "shipment"@"sel$7")

use_hash(@"sel$201a8568" "shipment_instruction"@"sel$8")

use_hash(@"sel$201a8568" "rfr"@"sel$1")

use_hash(@"sel$201a8568" "location_space"@"sel$13")

use_hash(@"sel$201a8568" "empty_pool_container"@"sel$9")

use_hash(@"sel$201a8568" "cntr_damage_dtl"@"sel$12")

use_hash(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$11")

px_join_filter(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$11")

swap_join_inputs(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$10")

swap_join_inputs(@"sel$201a8568" "shipment"@"sel$7")

swap_join_inputs(@"sel$201a8568" "shipment_instruction"@"sel$8")

swap_join_inputs(@"sel$201a8568" "rfr"@"sel$1")

swap_join_inputs(@"sel$201a8568" "location_space"@"sel$13")

swap_join_inputs(@"sel$201a8568" "empty_pool_container"@"sel$9")

swap_join_inputs(@"sel$201a8568" "cntr_damage_dtl"@"sel$12")

swap_join_inputs(@"sel$201a8568" "locn_gp_access_ctrl_gp_member"@"sel$11")

no_access(@"sel$b584fdd1" "c"@"sel$14")

full(@"sel$b584fdd1" "reefer_monitoring_log"@"sel$16")

leading(@"sel$b584fdd1" "c"@"sel$14" "reefer_monitoring_log"@"sel$16")

use_hash(@"sel$b584fdd1" "reefer_monitoring_log"@"sel$16")

index_ffs(@"sel$e9ce8d49" "reefer_monitoring_log"@"sel$19" ("reefer_monitoring_log"."reefer_handling_cycle_mode"

"reefer_monitoring_log"."cntr_id" "reefer_monitoring_log"."reefer_monitoring_datetime"))

use_hash_aggregation(@"sel$e9ce8d49")

index_rs_asc(@"sel$335dd26a" "gate_log"@"sel$3" ("gate_log"."cntr_id" "gate_log"."cms_no"))

index_rs_asc(@"sel$7286615e" "gate_log"@"sel$5" ("gate_log"."cntr_id" "gate_log"."cms_no"))

end_outline_data

*/cntr.created_by_opr_unit created_by_opr_unit,

*********

from

*****.

Oracle統計資訊收集

統計資訊收集 1 建立分析表 cd oracle home rdbms admin sqlplus as sysdba utlxplan.sql 2 為了方便,可以建立乙個同義表 預設情況下只有sys使用者可以使用 sql create public synonym plan tables for ...

Oracle 收集物件統計資訊

一.概述 oracle9i之前,由dba負責收集物件統計資訊。預設情況下,資料庫不提供物件統計資訊。到了oracle10g,在建立資料庫的時候,就建立了乙個定期收集物件統計資訊的作業並進行排程。以便擁有最新的物件統計資訊,因為表時刻都在變化,假如某一時刻插入了資料,物件統計資訊也需要更新的。二.收集...

Oracle統計資訊收集失敗案例

摘要 有個資料庫顯示作業按照正常時間點執行,但是統計資訊並未更新,導致資料庫統計資訊陳舊,產生大量錯誤的執行計畫。查詢是否被鎖 解決方法 execute dbms scheduler.close window saturday window 再次檢視作業狀態 select window name,a...