Transformation之simple view merge 【三】
能從view中拿到rowid 我們就稱之為簡單的view
view
被儲存的view
複雜的view
union/union-all
group-by
distinct
複雜view
not complex
in-line view(寫到from後的子查詢)
from子句帶的子查詢
普通的view merge:
點選( 此處 )摺疊或開啟
-
create or replace view emp_mgr_view as
-
select e . ename employee , m . ename manager , e . deptno from emp e , emp m
-
where e . mgr = m . empno ;
-
-
@10053 . sql alter session set events '10053 trace name context forever ,level 1';
-
select / * sample - 3 * /
-
employee , manager
-
from emp_mgr_view
-
where deptno = 20 ;
-
-
select * from table ( dbms_xplan . display_cursor ( null , null , 'last' ) ) ;
-
@10053d . sql
oracle 把這個檢視消除了,變成了一個簡單了的關聯查詢
將這個查詢轉化成
如下:
把view和外邊的查詢合併在一起,成為了一個merge(
(使)混合;相融;融入;漸漸消失在某物中
)這是merge英文的含義,oracle直接訪問你的表、不會說先生成檢視,然後再訪問檢視。
可以指定引數關閉掉 這個功能
simple view merge 根本就沒有打在10053裡面,下面我們看看生成的10053.進入到10053之前sql已經轉好
點選( 此處 )摺疊或開啟
-
* * * 2015 - 02 - 26 04 : 02 : 49 . 961
-
* * * SESSION ID : ( 56 . 153 ) 2015 - 02 - 26 04 : 02 : 49 . 961
-
* * * CLIENT ID : ( ) 2015 - 02 - 26 04 : 02 : 49 . 961
-
* * * SERVICE NAME : ( SYS$USERS ) 2015 - 02 - 26 04 : 02 : 49 . 961
-
* * * MODULE NAME : ( SQL * Plus ) 2015 - 02 - 26 04 : 02 : 49 . 961
-
* * * ACTION NAME : ( ) 2015 - 02 - 26 04 : 02 : 49 . 961
-
-
Registered qb : SEL$1 0x3e8d6678 ( PARSER )
-
- - - - - - - - - - - - - - - - - - - - -
-
QUERY BLOCK SIGNATURE
-
- - - - - - - - - - - - - - - - - - - - -
-
signature ( ) : qb_name = SEL$1 nbfros = 1 flg =
-
fro ( ) : flg = 5 objn = 78822 hint_alias = "EMP_MGR_VIEW" @ "SEL$1"
-
-
Registered qb : SEL$2 0x3e8d1020 ( PARSER )
-
- - - - - - - - - - - - - - - - - - - - -
-
QUERY BLOCK SIGNATURE
-
- - - - - - - - - - - - - - - - - - - - -
-
signature ( ) : qb_name = SEL$2 nbfros = 2 flg =
-
fro ( ) : flg = 4 objn = 75335 hint_alias = E @ SEL$2
-
fro ( 1 ) : flg = 4 objn = 75335 hint_alias = M @ SEL$2
-
-
SPM : statement not found in SMB
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Automatic degree of parallelism ( ADOP )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Automatic degree of parallelism is disabled : Parameter .
-
-
PM : Considering predicate move - around in query block SEL$1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Predicate Move - Around ( PM )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
OPTIMIZER INFORMATION
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- - - - - Current SQL Statement for this session ( sql_id = 1mfmysf37dut4 ) - - - - -
-
select / * sample - 3 * /
-
employee , manager
-
from emp_mgr_view
-
where deptno = 20
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Legend
-
The following abbreviations are used by optimizer trace .
-
CBQT - cost - based query transformation
-
JPPD - join predicate push - down
-
OJPPD - old - style ( non - cost - based ) JPPD
-
FPD - filter push - down
-
PM - predicate move - around
-
CVM - complex view merging
-
SPJ - select - project - join
-
SJC - set join conversion
-
SU - subquery unnesting
-
OBYE - order by elimination
-
OST - old style star transformation
-
ST - new ( cbqt ) star transformation
-
CNT - count ( col ) to count ( * ) transformation
-
JE - Join Elimination
-
JF - join factorization
-
SLP - select list pruning
-
DP - distinct placement
-
qb - query block
-
LB - leaf blocks
-
DK - distinct keys
-
LB/K - average number of leaf blocks per key
-
DB/K - average number of data blocks per key
-
CLUF - clustering factor
-
NDV - number of distinct values
-
Resp - response cost
-
Card - cardinality
-
Resc - resource cost
-
NL - nested loops ( join )
-
SM - sort merge ( join )
-
HA - hash ( join )
-
CPUSPEED - CPU Speed
-
IOTFRSPEED - I/O transfer speed
-
IOSEEKTIM - I/O seek time
-
SREADTIM - average single block read time
-
MREADTIM - average multiblock read time
-
MBRC - average multiblock read count
-
MAXTHR - maximum I/O system throughput
-
SLAVETHR - average slave I/O throughput
-
dmeth - distribution method
-
1 : no partitioning required
-
2 : value partitioned
-
4 : right is random ( round - robin )
-
128 : left is random ( round - robin )
-
8 : broadcast right and partition left
-
16 : broadcast left and partition right
-
32 : partition left using partitioning of right
-
64 : partition right using partitioning of left
-
256 : run the join in serial
-
0 : invalid distribution method
-
sel - selectivity
-
ptn - partition
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
PARAMETERS USED BY THE OPTIMIZER
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
PARAMETERS WITH ALTERED VALUES
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Compilation Environment Dump
-
Bug Fix Control Environment
-
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
PARAMETERS WITH DEFAULT VALUES
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Compilation Environment Dump
-
optimizer_mode_hinted = false
-
optimizer_features_hinted = 0 . .
-
parallel_execution_enabled = true
-
parallel_query_forced_dop = 0
-
parallel_dml_forced_dop = 0
-
parallel_ddl_forced_degree = 0
-
parallel_ddl_forced_instances = 0
-
_query_rewrite_fudge = 90
-
optimizer_features_enable = 11 . 2 . . 3
-
_optimizer_search_limit = 5
-
cpu_count = 1
-
active_instance_count = 1
-
parallel_threads_per_cpu = 2
-
hash_area_size = 131072
-
bitmap_merge_area_size = 1048576
-
sort_area_size = 65536
-
sort_area_retained_size = 0
-
_sort_elimination_cost_ratio = 0
-
_optimizer_block_size = 8192
-
_sort_multiblock_read_count = 2
-
_hash_multiblock_io_count = 0
-
_db_file_optimizer_read_count = 8
-
_optimizer_max_permutations = 2000
-
pga_aggregate_target = 286720 KB
-
_pga_max_size = 204800 KB
-
_query_rewrite_maxdisjunct = 257
-
_smm_auto_min_io_size = 56 KB
-
_smm_auto_max_io_size = 248 KB
-
_smm_min_size = 286 KB
-
_smm_max_size = 57344 KB
-
_smm_px_max_size = 143360 KB
-
_cpu_to_io = 0
-
_optimizer_undo_cost_change = 11 . 2 . . 3
-
parallel_query_mode = enabled
-
parallel_dml_mode = disabled
-
parallel_ddl_mode = enabled
-
optimizer_mode = all_rows
-
sqlstat_enabled = false
-
_optimizer_percent_parallel = 101
-
_always_anti_join = choose
-
_always_semi_join = choose
-
_optimizer_mode_force = true
-
_partition_view_enabled = true
-
_always_star_transformation = false
-
_query_rewrite_or_error = false
-
_hash_join_enabled = true
-
cursor_sharing = exact
-
_b_tree_bitmap_plans = true
-
star_transformation_enabled = false
-
_optimizer_cost_model = choose
-
_new_sort_cost_estimate = true
-
_complex_view_merging = true
-
_unnest_subquery = true
-
_eliminate_common_subexpr = true
-
_pred_move_around = true
-
_convert_set_to_join = false
-
_push_join_predicate = true
-
_push_join_union_view = true
-
_fast_full_scan_enabled = true
-
_optim_enhance_nnull_detection = true
-
_parallel_broadcast_enabled = true
-
_px_broadcast_fudge_factor = 100
-
_ordered_nested_loop = true
-
_no_or_expansion = false
-
optimizer_index_cost_adj = 100
-
optimizer_index_caching = 0
-
_system_index_caching = 0
-
_disable_datalayer_sampling = false
-
query_rewrite_enabled = true
-
query_rewrite_integrity = enforced
-
_query_cost_rewrite = true
-
_query_rewrite_2 = true
-
_query_rewrite_1 = true
-
_query_rewrite_expression = true
-
_query_rewrite_jgmigrate = true
-
_query_rewrite_fpc = true
-
_query_rewrite_drj = true
-
_full_pwise_join_enabled = true
-
_partial_pwise_join_enabled = true
-
_left_nested_loops_random = true
-
_improved_row_length_enabled = true
-
_index_join_enabled = true
-
_enable_type_dep_selectivity = true
-
_improved_outerjoin_card = true
-
_optimizer_adjust_for_nulls = true
-
_optimizer_degree = 0
-
_use_column_stats_for_function = true
-
_subquery_pruning_enabled = true
-
_subquery_pruning_mv_enabled = false
-
_or_expand_nvl_predicate = true
-
_like_with_bind_as_equality = false
-
_table_scan_cost_plus_one = true
-
_cost_equality_semi_join = true
-
_default_non_equality_sel_check = true
-
_new_initial_join_orders = true
-
_oneside_colstat_for_equijoins = true
-
_optim_peek_user_binds = true
-
_minimal_stats_aggregation = true
-
_force_temptables_for_gsets = false
-
workarea_size_policy = auto
-
_smm_auto_cost_enabled = true
-
_gs_anti_semi_join_allowed = true
-
_optim_new_default_join_sel = true
-
optimizer_dynamic_sampling = 2
-
_pre_rewrite_push_pred = true
-
_optimizer_new_join_card_computation = true
-
_union_rewrite_for_gs = yes_gset_mvs
-
_generalized_pruning_enabled = true
-
_optim_adjust_for_part_skews = true
-
_force_datefold_trunc = false
-
statistics_level = typical
-
_optimizer_system_stats_usage = true
-
skip_unusable_indexes = true
-
_remove_aggr_subquery = true
-
_optimizer_push_down_distinct = 0
-
_dml_monitoring_enabled = true
-
_optimizer_undo_changes = false
-
_predicate_elimination_enabled = true
-
_nested_loop_fudge = 100
-
_project_view_columns = true
-
_local_communication_costing_enabled = true
-
_local_communication_ratio = 50
-
_query_rewrite_vop_cleanup = true
-
_slave_mapping_enabled = true
-
_optimizer_cost_based_transformation = linear
-
_optimizer_mjc_enabled = true
-
_right_outer_hash_enable = true
-
_spr_push_pred_refspr = true
-
_optimizer_cache_stats = false
-
_optimizer_cbqt_factor = 50
-
_optimizer_squ_bottomup = true
-
_fic_area_size = 131072
-
_optimizer_skip_scan_enabled = true
-
_optimizer_cost_filter_pred = false
-
_optimizer_sortmerge_join_enabled = true
-
_optimizer_join_sel_sanity_check = true
-
_mmv_query_rewrite_enabled = true
-
_bt_mmv_query_rewrite_enabled = true
-
_add_stale_mv_to_dependency_list = true
-
_distinct_view_unnesting = false
-
_optimizer_dim_subq_join_sel = true
-
_optimizer_disable_strans_sanity_checks = 0
-
_optimizer_compute_index_stats = true
-
_push_join_union_view2 = true
-
_optimizer_ignore_hints = false
-
_optimizer_random_plan = 0
-
_query_rewrite_setopgrw_enable = true
-
_optimizer_correct_sq_selectivity = true
-
_disable_function_based_index = false
-
_optimizer_join_order_control = 3
-
_optimizer_cartesian_enabled = true
-
_optimizer_starplan_enabled = true
-
_extended_pruning_enabled = true
-
_optimizer_push_pred_cost_based = true
-
_optimizer_null_aware_antijoin = true
-
_optimizer_extend_jppd_view_types = true
-
_sql_model_unfold_forloops = run_time
-
_enable_dml_lock_escalation = false
-
_bloom_filter_enabled = true
-
_update_bji_ipdml_enabled = 0
-
_optimizer_extended_cursor_sharing = udo
-
_dm_max_shared_pool_pct = 1
-
_optimizer_cost_hjsmj_multimatch = true
-
_optimizer_transitivity_retain = true
-
_px_pwg_enabled = true
-
optimizer_secure_view_merging = true
-
_optimizer_join_elimination_enabled = true
-
flashback_table_rpi = non_fbt
-
_optimizer_cbqt_no_size_restriction = true
-
_optimizer_enhanced_filter_push = true
-
_optimizer_filter_pred_pullup = true
-
_rowsrc_trace_level = 0
-
_simple_view_merging = true
-
_optimizer_rownum_pred_based_fkr = true
-
_optimizer_better_inlist_costing = all
-
_optimizer_self_induced_cache_cost = false
-
_optimizer_min_cache_blocks = 10
-
_optimizer_or_expansion = depth
-
_optimizer_order_by_elimination_enabled = true
-
_optimizer_outer_to_anti_enabled = true
-
_selfjoin_mv_duplicates = true
-
_dimension_skip_null = true
-
_force_rewrite_enable = false
-
_optimizer_star_tran_in_with_clause = true
-
_optimizer_complex_pred_selectivity = true
-
_optimizer_connect_by_cost_based = true
-
_gby_hash_aggregation_enabled = true
-
_globalindex_pnum_filter_enabled = true
-
_px_minus_intersect = true
-
_fix_control_key = 0
-
_force_slave_mapping_intra_part_loads = false
-
_force_tmp_segment_loads = false
-
_query_mmvrewrite_maxpreds = 10
-
_query_mmvrewrite_maxintervals = 5
-
_query_mmvrewrite_maxinlists = 5
-
_query_mmvrewrite_maxdmaps = 10
-
_query_mmvrewrite_maxcmaps = 20
-
_query_mmvrewrite_maxregperm = 512
-
_query_mmvrewrite_maxqryinlistvals = 500
-
_disable_parallel_conventional_load = false
-
_trace_virtual_columns = false
-
_replace_virtual_columns = true
-
_virtual_column_overload_allowed = true
-
_kdt_buffering = true
-
_first_k_rows_dynamic_proration = true
-
_optimizer_sortmerge_join_inequality = true
-
_optimizer_aw_stats_enabled = true
-
_bloom_pruning_enabled = true
-
result_cache_mode = MANUAL
-
_px_ual_serial_input = true
-
_optimizer_skip_scan_guess = false
-
_enable_row_shipping = true
-
_row_shipping_threshold = 80
-
_row_shipping_explain = false
-
transaction_isolation_level = read_commited
-
_optimizer_distinct_elimination = true
-
_optimizer_multi_level_push_pred = true
-
_optimizer_group_by_placement = true
-
_optimizer_rownum_bind_default = 10
-
_enable_query_rewrite_on_remote_objs = true
-
_optimizer_extended_cursor_sharing_rel = simple
-
_optimizer_adaptive_cursor_sharing = true
-
_direct_path_insert_features = 0
-
_optimizer_improve_selectivity = true
-
optimizer_use_pending_statistics = false
-
_optimizer_enable_density_improvements = true
-
_optimizer_aw_join_push_enabled = true
-
_optimizer_connect_by_combine_sw = true
-
_enable_pmo_ctas = 0
-
_optimizer_native_full_outer_join = force
-
_bloom_predicate_enabled = true
-
_optimizer_enable_extended_stats = true
-
_is_lock_table_for_ddl_wait_lock = 0
-
_pivot_implementation_method = choose
-
optimizer_capture_sql_plan_baselines = false
-
optimizer_use_sql_plan_baselines = true
-
_optimizer_star_trans_min_cost = 0
-
_optimizer_star_trans_min_ratio = 0
-
_with_subquery = OPTIMIZER
-
_optimizer_fkr_index_cost_bias = 10
-
_optimizer_use_subheap = true
-
parallel_degree_policy = manual
-
parallel_degree = 0
-
parallel_min_time_threshold = 10
-
_parallel_time_unit = 10
-
_optimizer_or_expansion_subheap = true
-
_optimizer_free_transformation_heap = true
-
_optimizer_reuse_cost_annotations = true
-
_result_cache_auto_size_threshold = 100
-
_result_cache_auto_time_threshold = 1000
-
_optimizer_nested_rollup_for_gset = 100
-
_nlj_batching_enabled = 1
-
parallel_query_default_dop = 0
-
is_recur_flags = 0
-
optimizer_use_invisible_indexes = false
-
flashback_data_archive_internal_cursor = 0
-
_optimizer_extended_stats_usage_control = 192
-
_parallel_syspls_obey_force = true
-
cell_offload_processing = true
-
_rdbms_internal_fplib_enabled = false
-
db_file_multiblock_read_count = 97
-
_bloom_folding_enabled = true
-
_mv_generalized_oj_refresh_opt = true
-
cell_offload_compaction = ADAPTIVE
-
cell_offload_plan_display = AUTO
-
_bloom_predicate_pushdown_to_storage = true
-
_bloom_vector_elements = 0
-
_bloom_pushing_max = 512
-
parallel_degree_limit = 65535
-
parallel_force_local = false
-
parallel_max_degree = 2
-
total_cpu_count = 1
-
_optimizer_coalesce_subqueries = true
-
_optimizer_fast_pred_transitivity = true
-
_optimizer_fast_access_pred_analysis = true
-
_optimizer_unnest_disjunctive_subq = true
-
_optimizer_unnest_corr_set_subq = true
-
_optimizer_distinct_agg_transform = true
-
_aggregation_optimization_settings = 0
-
_optimizer_connect_by_elim_dups = true
-
_optimizer_eliminate_filtering_join = true
-
_connect_by_use_union_all = true
-
dst_upgrade_insert_conv = true
-
advanced_queuing_internal_cursor = 0
-
_optimizer_unnest_all_subqueries = true
-
parallel_autodop = 0
-
parallel_ddldml = 0
-
_parallel_cluster_cache_policy = adaptive
-
_parallel_scalability = 50
-
iot_internal_cursor = 0
-
_optimizer_instance_count = 0
-
_optimizer_connect_by_cb_whr_only = false
-
_suppress_scn_chk_for_cqn = nosuppress_1466
-
_optimizer_join_factorization = true
-
_optimizer_use_cbqt_star_transformation = true
-
_optimizer_table_expansion = true
-
_and_pruning_enabled = true
-
_deferred_constant_folding_mode = DEFAULT
-
_optimizer_distinct_placement = true
-
partition_pruning_internal_cursor = 0
-
parallel_hinted = none
-
_sql_compatibility = 0
-
_optimizer_use_feedback = true
-
_optimizer_try_st_before_jppd = true
-
_dml_frequency_tracking = false
-
_optimizer_interleave_jppd = true
-
kkb_drop_empty_segments = 0
-
_px_partition_scan_enabled = true
-
_px_partition_scan_threshold = 64
-
_optimizer_false_filter_pred_pullup = true
-
_bloom_minmax_enabled = true
-
only_move_row = 0
-
_optimizer_enable_table_lookup_by_nl = true
-
deferred_segment_creation = true
-
_optimizer_filter_pushdown = true
-
_allow_level_without_connect_by = false
-
_max_rwgs_groupings = 8192
-
_optimizer_outer_join_to_inner = true
-
_optimizer_full_outer_join_to_outer = true
-
_px_numa_support_enabled = true
-
total_processor_group_count = 1
-
Bug Fix Control Environment
-
fix 3834770 = 1
-
fix 3746511 = enabled
-
fix 4519016 = enabled
-
fix 3118776 = enabled
-
fix 4488689 = enabled
-
-
... ...
-
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
PARAMETERS IN OPT_PARAM HINT
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Column Usage Monitoring is ON : tracking level = 1
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
Considering Query Transformations on query block SEL$1 ( # ) ----開始transformation
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Query transformations ( QT )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
JF : Checking validity of join factorization for query block SEL$2 ( # )
-
JF : Bypassed : not a UNION or UNION - ALL query block .
-
ST : not valid since star transformation parameter is FALSE
-
TE : Checking validity of table expansion for query block SEL$2 ( # )
-
TE : Bypassed : No partitioned table in query block .
-
Check Basic Validity for Non - Union View for query block SEL$2 ( # )
-
JPPD : JPPD bypassed : View has unsupported constructs .
-
JF : Checking validity of join factorization for query block SEL$1 ( # )
-
JF : Bypassed : not a UNION or UNION - ALL query block .
-
ST : not valid since star transformation parameter is FALSE
-
TE : Checking validity of table expansion for query block SEL$1 ( # )
-
TE : Bypassed : No partitioned table in query block .
-
CBQT bypassed for query block SEL$1 ( # ) : no complex view , sub - queries or UNION ( ALL ) queries .
-
CBQT : Validity checks failed for 1mfmysf37dut4 .
-
CSE : Considering common sub - expression elimination in query block SEL$1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Common Subexpression elimination ( CSE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
CSE : Considering common sub - expression elimination in query block SEL$2 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Common Subexpression elimination ( CSE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
CSE : CSE not performed on query block SEL$2 ( # ) .
-
CSE : CSE not performed on query block SEL$1 ( # ) .
-
OBYE : Considering Order - by Elimination from view SEL$1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Order - by elimination ( OBYE )
-
* * * * * * * * * * * * * * * * * * * * * * * * * * *
-
OBYE : OBYE bypassed : no order by to eliminate .
-
JE : Considering Join Elimination on query block SEL$2 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Join Elimination ( JE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER , E . DEPTNO DEPTNO FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . MGR = M . EMPNO 這裡已經給你做好了轉換
-
JE : cfro : EMP objn : 75335 col# : 4 dfro : EMP dcol# : 1
-
JE : cfro : EMP objn : 75335 col# : 1 dfro : EMP dcol# : 4
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER , E . DEPTNO DEPTNO FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . MGR = M . EMPNO
-
Query block SEL$2 ( # ) unchanged
-
CVM : Considering view merge in query block SEL$1 ( # )
-
OJE : Begin : find best directive for query block SEL$1 ( # )
-
OJE : End : finding best directive for query block SEL$1 ( # )
-
CVM : Checking validity of merging in query block SEL$2 ( # )
-
CVM : Considering view merge in query block SEL$2 ( # )
-
OJE : Begin : find best directive for query block SEL$2 ( # )
-
OJE : End : finding best directive for query block SEL$2 ( # )
-
CVM : Merging SPJ view SEL$2 ( # ) into SEL$1 ( # ) ---從$2merge到$1裡面,說明merger了,但是沒有打出來,simple和complex view都用CVM標示
-
Registered qb : SEL$F5BB74E1 0x3e8d6678 ( VIEW MERGE SEL$1 ; SEL$2 )
-
- - - - - - - - - - - - - - - - - - - - -
-
QUERY BLOCK SIGNATURE
-
- - - - - - - - - - - - - - - - - - - - -
-
signature ( ) : qb_name = SEL$F5BB74E1 nbfros = 2 flg =
-
fro ( ) : flg = 0 objn = 75335 hint_alias = "E" @ "SEL$2"
-
fro ( 1 ) : flg = 0 objn = 75335 hint_alias = "M" @ "SEL$2"
-
-
OJE : Begin : find best directive for query block SEL$F5BB74E1 ( # )
-
OJE : End : finding best directive for query block SEL$F5BB74E1 ( # )
-
JE : Considering Join Elimination on query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Join Elimination ( JE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
JE : cfro : EMP objn : 75335 col# : 4 dfro : EMP dcol# : 1
-
JE : cfro : EMP objn : 75335 col# : 1 dfro : EMP dcol# : 4
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
Query block SEL$F5BB74E1 ( # ) unchanged
-
query block SEL$1 transformed to SEL$F5BB74E1 ( # )
-
Considering Query Transformations on query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Query transformations ( QT )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
JF : Checking validity of join factorization for query block SEL$F5BB74E1 ( # )
-
JF : Bypassed : not a UNION or UNION - ALL query block .
-
ST : not valid since star transformation parameter is FALSE
-
TE : Checking validity of table expansion for query block SEL$F5BB74E1 ( # )
-
TE : Bypassed : No partitioned table in query block .
-
CBQT bypassed for query block SEL$F5BB74E1 ( # ) : no complex view , sub - queries or UNION ( ALL ) queries .
-
CBQT : Validity checks failed for 1mfmysf37dut4 .
-
CSE : Considering common sub - expression elimination in query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Common Subexpression elimination ( CSE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
CSE : CSE not performed on query block SEL$F5BB74E1 ( # ) .
-
SU : Considering subquery unnesting in query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * *
-
Subquery Unnest ( SU )
-
* * * * * * * * * * * * * * * * * * * *
-
SJC : Considering set - join conversion in query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Set - Join Conversion ( SJC )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
SJC : not performed
-
JE : Considering Join Elimination on query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
Join Elimination ( JE )
-
* * * * * * * * * * * * * * * * * * * * * * * * *
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
JE : cfro : EMP objn : 75335 col# : 4 dfro : EMP dcol# : 1
-
JE : cfro : EMP objn : 75335 col# : 1 dfro : EMP dcol# : 4
-
SQL : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT E . ENAME EMPLOYEE , M . ENAME MANAGER FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
Query block SEL$F5BB74E1 ( # ) unchanged
-
PM : Considering predicate move - around in query block SEL$F5BB74E1 ( # )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
Predicate Move - Around ( PM )
-
* * * * * * * * * * * * * * * * * * * * * * * * * *
-
PM : PM bypassed : Outer query contains no views .
-
PM : PM bypassed : Outer query contains no views .
-
query block SEL$F5BB74E1 ( # ) unchanged
-
FPD : Considering simple filter push in query block SEL$F5BB74E1 ( # )
-
E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
try to generate transitive predicate from check constraints for query block SEL$F5BB74E1 ( # )
-
finally : E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
-
apadrv - start sqlid = 1853933574856043300
-
:
-
call ( in - use = 4048 , alloc = 16344 ) , compile ( in - use = 78440 , alloc = 79352 ) , execution ( in - use = 4072 , alloc = 8088 )
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Peeked values of the binds in SQL statement
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
Final query after transformations : * * * * * * * UNPARSED QUERY IS * * * * * * *
-
SELECT "E . ENAME EMPLOYEE , M . ENAME MANAGER FROM SCOTT . EMP E , SCOTT . EMP M WHERE E . DEPTNO = 20 AND E . MGR = M . EMPNO
-
kkoqbc : optimizing query block SEL$F5BB74E1 ( # )
-
-
:
-
call ( in - use = 4152 , alloc = 16344 ) , compile ( in - use = 79712 , alloc = 83496 ) , execution ( in - use = 4072 , alloc = 8088 )
-
-
kkoqbc - subheap ( create addr = 0x2b043e8dfaa0 )
-
* * * * * * * * * * * * * * * *
-
QUERY BLOCK TEXT
-
* * * * * * * * * * * * * * * *
-
select / * sample - 3 * /
-
employee , manager
-
from emp_mgr_view
-
where deptno = 20
-
- - - - - - - - - - - - - - - - - - - - -
-
QUERY BLOCK SIGNATURE
-
- - - - - - - - - - - - - - - - - - - - -
-
signature ( optimizer ) : qb_name = SEL$F5BB74E1 nbfros = 2 flg =
-
fro ( ) : flg = 0 objn = 75335 hint_alias = "E" @ "SEL$2"
-
fro ( 1 ) : flg = 0 objn = 75335 hint_alias = "M" @ "SEL$2"
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
SYSTEM STATISTICS INFORMATION
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Using NOWORKLOAD Stats
-
CPUSPEEDNW : 1752 millions instructions/sec ( default is 100 )
-
IOTFRSPEED : 4096 bytes per millisecond ( default is 4096 )
-
IOSEEKTIM : 10 milliseconds ( default is 10 )
-
MBRC : NO VALUE blocks ( default is 8 )
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
BASE STATISTICAL INFORMATION
-
* * * * * * * * * * * * * * * * * * * * * * *
-
Table Stats : : ---這裡是表的統計資訊
-
Table : EMP Alias : M
-
#Rows : 14 #Blks : 5 AvgRowLen : 38 . 00 ChainCnt : 0 . 00 ---一共過少chain
-
Column ( # 1 ) : EMPNO (
-
AvgLen : 4 NDV : 14 Nulls : 0 Density : 0 . 071429 Min : 7369 Max : 7934 --列平均長度
-
Index Stats : : ----這裡是index的統計資訊
-
Index : PK_EMP Col# : 1
-
LVLS : 0 #LB : 1 #DK : 14 LB/K : 1 . 00 DB/K : 1 . 00 CLUF : 1 . 00 ---LVLS 是blevel, CLUF:cluster factor
-
* * * * * * * * * * * * * * * * * * * * * * *
-
Table Stats : : ----優化器認為涉及到2兩張表
-
Table : EMP Alias : E
-
#Rows : 14 #Blks : 5 AvgRowLen : 38 . 00 ChainCnt : 0 . 00
-
Column ( # 4 ) : MGR (
-
AvgLen : 4 NDV : 6 Nulls : 1 Density : 0 . 166667 Min : 7566 Max : 7902
-
Index Stats : :
-
Index : PK_EMP Col# : 1
-
LVLS : 0 #LB : 1 #DK : 14 LB/K : 1 . 00 DB/K : 1 . 00 CLUF : 1 . 00
-
Access path analysis for EMP
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
SINGLE TABLE ACCESS PATH ---研究單表訪問成本
-
Single Table Cardinality Estimation for EMP [ E ]
-
Column ( # 8 ) : DEPTNO (
-
AvgLen : 3 NDV : 3 Nulls : 0 Density : 0 . 333333 Min : 10 Max : 30
-
-
Table : EMP Alias : E
-
Card : Original : 14 . 000000 Rounded : 4 Computed : 4 . 33 Non Adjusted : 4 . 33
-
Access Path : TableScan
-
Cost : 3 . 00 Resp : 3 . 00 Degree : 0
-
Cost_io : 3 . 00 Cost_cpu : 40461
-
Resp_io : 3 . 00 Resp_cpu : 40461
-
Best : : AccessPath : TableScan
-
Cost : 3 . 00 Degree : 1 Resp : 3 . 00 Card : 4 . 33 Bytes : 0
-
-
Access path analysis for EMP
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
SINGLE TABLE ACCESS PATH
-
Single Table Cardinality Estimation for EMP [ M ]
-
Table : EMP Alias : M
-
Card : Original : 14 . 000000 Rounded : 14 Computed : 14 . 00 Non Adjusted : 14 . 00
-
Access Path : TableScan
-
Cost : 3 . 00 Resp : 3 . 00 Degree : 0
-
Cost_io : 3 . 00 Cost_cpu : 37987
-
Resp_io : 3 . 00 Resp_cpu : 37987
-
Best : : AccessPath : TableScan
-
Cost : 3 . 00 Degree : 1 Resp : 3 . 00 Card : 14 . 00 Bytes : 0
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
-
OPTIMIZER STATISTICS AND COMPUTATIONS
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
GENERAL PLANS
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Considering cardinality - based initial join order .
-
Permutations for Starting Table :
-
Join order [ 1 ] : EMP [ E ] # 0 EMP [ M ] # 1 ---這是第一個驅動和被驅動 E做驅動表 M做被驅動表
-
-
* * * * * * * * * * * * * * *
-
Now joining : EMP [ M ] # 1
-
* * * * * * * * * * * * * * *
-
NL Join
-
Outer table : Card : 4 . 33 Cost : 3 . 00 Resp : 3 . 00 Degree : 1 Bytes : 13
-
Access path analysis for EMP
-
Inner table : EMP Alias : M
-
Access Path : TableScan
-
NL Join : Cost : 10 . 01 Resp : 10 . 01 Degree : 1
-
Cost_io : 10 . 00 Cost_cpu : 192409
-
Resp_io : 10 . 00 Resp_cpu : 192409
-
Access Path : index ( UniqueScan )
-
Index : PK_EMP
-
resc_io : 1 . 00 resc_cpu : 8341
-
ix_sel : 0 . 071429 ix_sel_with_filters : 0 . 071429
-
NL Join : Cost : 7 . 00 Resp : 7 . 00 Degree : 1
-
Cost_io : 7 . 00 Cost_cpu : 73826
-
Resp_io : 7 . 00 Resp_cpu : 73826
-
Access Path : index ( AllEqUnique )
-
Index : PK_EMP
-
resc_io : 1 . 00 resc_cpu : 8341
-
ix_sel : 0 . 071429 ix_sel_with_filters : 0 . 071429
-
NL Join : Cost : 7 . 00 Resp : 7 . 00 Degree : 1
-
Cost_io : 7 . 00 Cost_cpu : 73826
-
Resp_io : 7 . 00 Resp_cpu : 73826
-
-
Best NL cost : 7 . 00
-
resc : 7 . 00 resc_io : 7 . 00 resc_cpu : 73826
-
resp : 7 . 00 resp_io : 7 . 00 resc_cpu : 73826
-
Join Card : 4 . 333333 = outer ( 4 . 333333 ) * inner ( 14 . 000000 ) * sel ( . 071429 )
-
Join Card - Rounded : 4 Computed : 4 . 33
-
Outer table : EMP Alias : E
-
resc : 3 . 00 card 4 . 33 bytes : 13 deg : 1 resp : 3 . 00
-
Inner table : EMP Alias : M
-
resc : 3 . 00 card : 14 . 00 bytes : 10 deg : 1 resp : 3 . 00
-
using dmeth : 2 #groups : 1
-
SORT ressource Sort statistics
-
Sort width : 334 Area size : 292864 Max Area size : 58720256
-
Degree : 1
-
Blocks to Sort : 1 Row size : 25 Total Rows : 4
-
Initial runs : 1 Merge passes : 0 IO Cost / pass : 0
-
Total IO sort cost : 0 Total CPU sort cost : 21021466
-
Total Temp space used : 0
-
SORT ressource Sort statistics
-
Sort width : 334 Area size : 292864 Max Area size : 58720256
-
Degree : 1
-
Blocks to Sort : 1 Row size : 21 Total Rows : 14
-
Initial runs : 1 Merge passes : 0 IO Cost / pass : 0
-
Total IO sort cost : 0 Total CPU sort cost : 21023507
-
Total Temp space used : 0
-
SM join : Resc : 8 . 00 Resp : 8 . 00 [ multiMatchCost = . 00 ]
-
SM Join
-
SM cost : 8 . 00
-
resc : 8 . 00 resc_io : 6 . 00 resc_cpu : 42123421
-
resp : 8 . 00 resp_io : 6 . 00 resp_cpu : 42123421
-
Outer table : EMP Alias : E
-
resc : 3 . 00 card 4 . 33 bytes : 13 deg : 1 resp : 3 . 00
-
Inner table : EMP Alias : M
-
resc : 3 . 00 card : 14 . 00 bytes : 10 deg : 1 resp : 3 . 00
-
using dmeth : 2 #groups : 1
-
Cost per ptn : 0 . 50 #ptns : 1
-
hash_area : 124 ( max = 14336 ) buildfrag : 1 probefrag : 1 ppasses : 1
-
Hash join : Resc : 6 . 50 Resp : 6 . 50 [ multiMatchCost = . 00 ]
-
HA Join
-
HA cost : 6 . 50
-
resc : 6 . 50 resc_io : 6 . 00 resc_cpu : 10591000
-
resp : 6 . 50 resp_io : 6 . 00 resp_cpu : 10591000
-
Best : : JoinMethod : Hash
-
Cost : 6 . 50 Degree : 1 Resp : 6 . 50 Card : 4 . 33 Bytes : 23
-
* * * * * * * * * * * * * * * * * * * * * * *
-
Best so far : Table# : 0 cost : 3 . 0019 card : 4 . 3333 bytes : 52
-
Table# : 1 cost : 6 . 5038 card : 4 . 3333 bytes : 92
-
* * * * * * * * * * * * * * * * * * * * * * *
-
Join order [ 2 ] : EMP [ M ] # 1 EMP [ E ] # 0 先順序[1]/[2],然後裡面包含nl sm hj
-
-
* * * * * * * * * * * * * * *
-
Now joining : EMP [ E ] #
-
* * * * * * * * * * * * * * *
-
NL Join
-
Outer table : Card : 14 . 00 Cost : 3 . 00 Resp : 3 . 00 Degree : 1 Bytes : 10
-
Access path analysis for EMP
-
Inner table : EMP Alias : E
-
Access Path : TableScan
-
NL Join : Cost : 24 . 03 Resp : 24 . 03 Degree : 1
-
Cost_io : 24 . 00 Cost_cpu : 604435
-
Resp_io : 24 . 00 Resp_cpu : 604435
-
-
Best NL cost : 24 . 03
-
resc : 24 . 03 resc_io : 24 . 00 resc_cpu : 604435
-
resp : 24 . 03 resp_io : 24 . 00 resc_cpu : 604435
-
Join Card : 4 . 333333 = outer ( 14 . 000000 ) * inner ( 4 . 333333 ) * sel ( . 071429 ) cardinality
-
Join Card - Rounded : 4 Computed : 4 . 33
-
Outer table : EMP Alias : M
-
resc : 3 . 00 card 14 . 00 bytes : 10 deg : 1 resp : 3 . 00
-
Inner table : EMP Alias : E
-
resc : 3 . 00 card : 4 . 33 bytes : 13 deg : 1 resp : 3 . 00
-
using dmeth : 2 #groups : 1
-
SORT ressource Sort statistics
-
Sort width : 334 Area size : 292864 Max Area size : 58720256
-
Degree : 1
-
Blocks to Sort : 1 Row size : 21 Total Rows : 14
-
Initial runs : 1 Merge passes : 0 IO Cost / pass : 0
-
Total IO sort cost : 0 Total CPU sort cost : 21023507
-
Total Temp space used : 0
-
SORT ressource Sort statistics
-
Sort width : 334 Area size : 292864 Max Area size : 58720256
-
Degree : 1
-
Blocks to Sort : 1 Row size : 25 Total Rows : 4
-
Initial runs : 1 Merge passes : 0 IO Cost / pass : 0
-
Total IO sort cost : 0 Total CPU sort cost : 21021466
-
Total Temp space used : 0
-
SM join : Resc : 8 . 00 Resp : 8 . 00 [ multiMatchCost = . 00 ]
-
SM Join
-
SM cost : 8 . 00
-
resc : 8 . 00 resc_io : 6 . 00 resc_cpu : 42123421
-
resp : 8 . 00 resp_io : 6 . 00 resp_cpu : 42123421
-
SM Join ( with index on outer )
-
Access Path : index ( FullScan )
-
Index : PK_EMP
-
resc_io : 2 . 00 resc_cpu : 19423
-
ix_sel : 1 . 000000 ix_sel_with_filters : 1 . 000000
-
Cost : 2 . 00 Resp : 2 . 00 Degree : 1
-
Outer table : EMP Alias : M
-
resc : 2 . 00 card 14 . 00 bytes : 10 deg : 1 resp : 2 . 00
-
Inner table : EMP Alias : E
-
resc : 3 . 00 card : 4 . 33 bytes : 13 deg : 1 resp : 3 . 00
-
using dmeth : 2 #groups : 1
-
SORT ressource Sort statistics
-
Sort width : 334 Area size : 292864 Max Area size : 58720256
-
Degree : 1
-
Blocks to Sort : 1 Row size : 25 Total Rows : 4
-
Initial runs : 1 Merge passes : 0 IO Cost / pass : 0
-
Total IO sort cost : 0 Total CPU sort cost : 21021466
-
Total Temp space used : 0
-
SM join : Resc : 6 . 00 Resp : 6 . 00 [ multiMatchCost = . 00 ]
-
Outer table : EMP Alias : M
-
resc : 3 . 00 card 14 . 00 bytes : 10 deg : 1 resp : 3 . 00
-
Inner table : EMP Alias : E
-
resc : 3 . 00 card : 4 . 33 bytes : 13 deg : 1 resp : 3 . 00
-
using dmeth : 2 #groups : 1
-
Cost per ptn : 0 . 50 #ptns : 1
-
hash_area : 124 ( max = 14336 ) buildfrag : 1 probefrag : 1 ppasses : 1
-
Hash join : Resc : 6 . 50 Resp : 6 . 50 [ multiMatchCost = . 00 ]
-
HA Join
-
HA cost : 6 . 50
-
resc : 6 . 50 resc_io : 6 . 00 resc_cpu : 10591500
-
resp : 6 . 50 resp_io : 6 . 00 resp_cpu : 10591500
-
Best : : JoinMethod : SortMerge
-
Cost : 6 . 00 Degree : 1 Resp : 6 . 00 Card : 4 . 33 Bytes : 23
-
* * * * * * * * * * * * * * * * * * * * * * *
-
Best so far : Table# : 1 cost : 2 . 0009 card : 14 . 0000 bytes : 140
-
Table# : 0 cost : 6 . 0029 card : 4 . 3333 bytes : 92
-
* * * * * * * * * * * * * * * * * * * * * * *
-
( newjo - stop - 1 ) k : , spcnt : , perm : 2 , maxperm : 2000
-
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Number of join permutations tried : 2
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
Consider using bloom filter between M [ EMP ] and E [ EMP ] with ? ?
-
kkoBloomFilter : join ( lcdn : 14 rcdn : 4 jcdn : 4 limit : 30 )
-
Computing bloom ndv for creator : M [ EMP ] ccdn : 14 . 0 and user : E [ EMP ] ucdn : 4 . 3
-
kkopqComputeBloomNdv : predicate ( bndv : 6 ndv : 6 ) and ( bndv : 14 ndv : 14 )
-
kkopqComputeBloomNdv : pred cnt : 2 ndv : 14 reduction : 3
-
kkoBloomFilter : join ndv : 0 reduction : 3 . 230769 ( limit : . 500000 ) rejected because distinct value ratio
-
Enumerating distribution method ( advanced )
-
- - - Distribution method for
-
join between M [ EMP ] ( serial ) and E [ EMP ] ( serial ) ; jm = 7 ; right side access path = TableScan
-
- - - - serial Sort - Merge - Join - > NONE
-
-
( newjo - save ) [ 0 1 ]
-
Trying or - Expansion on query block SEL$F5BB74E1 ( # )
-
Transfer Optimizer annotations for query block SEL$F5BB74E1 ( # )
-
id = 0 frofkksm [ i ] ( sort - merge/hash ) predicate = "E" . "MGR" = "M" . "EMPNO"
-
id = 0 frosand ( sort - merge/hash ) predicate = "E" . "MGR" = "M" . "EMPNO"
-
id = 0 frofand predicate = "E" . "DEPTNO" = 20 AND "E" . "MGR" IS NOT NULL
-
Final cost for query block SEL$F5BB74E1 ( # ) - All Rows Plan :
-
Best join order : 2
-
Cost : 6 . 0029 Degree : 1 Card : 4 . 0000 Bytes : 92
-
Resc : 6 . 0029 Resc_io : 5 . 0000 Resc_cpu : 21081349
-
Resp : 6 . 0029 Resp_io : 5 . 0000 Resc_cpu : 21081349
-
kkoqbc - subheap ( delete addr = 0x2b043e8dfaa0 , in - use = 27216 , alloc = 32840 )
-
kkoqbc - end :
-
:
-
call ( in - use = 19488 , alloc = 82024 ) , compile ( in - use = 82560 , alloc = 83496 ) , execution ( in - use = 4072 , alloc = 8088 )
-
-
kkoqbc : finish optimizing query block SEL$F5BB74E1 ( # )
-
apadrv - end
-
:
-
call ( in - use = 19488 , alloc = 82024 ) , compile ( in - use = 83544 , alloc = 87640 ) , execution ( in - use = 4072 , alloc = 8088 )
-
-
-
Starting SQL statement dump
-
-
user_id = 83 user_name = SCOTT module = SQL * Plus action =
-
sql_id = 1mfmysf37dut4 plan_hash_value = 992080948 problem_type = 3
-
- - - - - Current SQL Statement for this session ( sql_id = 1mfmysf37dut4 ) - - - - -
-
select / * sample - 3 * /
-
employee , manager
-
from emp_mgr_view
-
where deptno = 20
-
sql_text_length = 75
-
sql = select / * sample - 3 * /
-
employee , manager
-
from emp_mgr_view
-
where deptno = 20
-
- - - - - Explain Plan Dump - - - - -
-
- - - - - Plan Table - - - - -
-
-
= = = = = = = = = = = =
-
Plan Table
-
= = = = = = = = = = = =
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
-
| Id | Operation | Name | Rows | Bytes | Cost | Time |
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
-
| 0 | SELECT STATEMENT | | | | 6 | |
-
| 1 | MERGE JOIN | | 4 | 92 | 6 | 00 : 00 : 01 |
-
| 2 | TABLE ACCESS BY INDEX ROWID | EMP | 14 | 140 | 2 | 00 : 00 : 01 |
-
| 3 | INDEX FULL SCAN | PK_EMP | 14 | | 1 | 00 : 00 : 01 |
-
| 4 | SORT JOIN | | 4 | 52 | 4 | 00 : 00 : 01 |
-
| 5 | TABLE ACCESS FULL | EMP | 4 | 52 | 3 | 00 : 00 : 01 |
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
-
Predicate Information :
-
- - - - - - - - - - - - - - - - - - - - - -
-
4 - access ( "E" . "MGR" = "M" . "EMPNO" )
-
4 - filter ( "E" . "MGR" = "M" . "EMPNO" )
-
5 - filter ( ( "E" . "DEPTNO" = 20 AND "E" . "MGR" IS NOT NULL ) )
-
-
Content of other_xml column
-
= = = = = = = = = = = = = = = = = = = = = = = = = = =
-
db_version : 11 . 2 . . 3
-
parse_schema : SCOTT
-
plan_hash : 992080948
-
plan_hash_2 : 1563151197
-
Outline Data :
-
/ * +
-
BEGIN_OUTLINE_DATA
-
IGNORE_OPTIM_EMBEDDED_HINTS
-
OPTIMIZER_FEATURES_ENABLE ( '11.2.0.3' )
-
DB_VERSION ( '11.2.0.3' )
-
ALL_ROWS
-
OUTLINE_LEAF ( @ "SEL$F5BB74E1" )
-
MERGE ( @ "SEL$2" )
-
OUTLINE ( @ "SEL$1" )
-
OUTLINE ( @ "SEL$2" )
-
INDEX ( @ "SEL$F5BB74E1" "M" @ "SEL$2" ( "EMP" . "EMPNO" ) )
-
FULL ( @ "SEL$F5BB74E1" "E" @ "SEL$2" )
-
LEADING ( @ "SEL$F5BB74E1" "M" @ "SEL$2" "E" @ "SEL$2" )
-
USE_MERGE ( @ "SEL$F5BB74E1" "E" @ "SEL$2" )
-
END_OUTLINE_DATA
-
* /
-
-
Optimizer state dump :
-
Compilation Environment Dump
-
optimizer_mode_hinted = false
-
... ...
點選(
此處
)摺疊或開啟
scott@TESTDB12
>
alter session set
"_simple_view_merging"
=
false
;
Session altered
.
select /
*
sample
-
3
*
/
employee
,
manager
from emp_mgr_view
4 where deptno
=
20
;
EMPLOYEE MANAGER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
SCOTT JONES
FORD JONES
ADAMS SCOTT
JONES KING
SMITH FORD
scott@TESTDB12
>
select
*
from table
(
dbms_xplan
.
display_cursor
(
null
,
null
,
'last'
)
)
;
PLAN_TABLE_OUTPUT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
SQL_ID 1mfmysf37dut4
,
child number 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
select /
*
sample
-
3
*
/
employee
,
manager from emp_mgr_view where deptno
=
20
Plan hash value
:
1461531747
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
Id
|
Operation
|
Name
|
Rows
|
Bytes
|
Cost
(
%
CPU
)
|
Time
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
0
|
SELECT STATEMENT
|
|
|
|
6
(
100
)
|
|
|
1
|
VIEW
|
EMP_MGR_VIEW
|
4
|
64
|
6
(
17
)
|
00
:
00
:
01
|
|
2
|
MERGE JOIN
|
|
4
|
92
|
6
(
17
)
|
00
:
00
:
01
|
|
3
|
TABLE ACCESS BY INDEX ROWID
|
EMP
|
14
|
140
|
2
(
)
|
00
:
00
:
01
|
|
4
|
INDEX FULL SCAN
|
PK_EMP
|
14
|
|
1
(
)
|
00
:
00
:
01
|
|
*
5
|
SORT JOIN
|
|
4
|
52
|
4
(
25
)
|
00
:
00
:
01
|
|
*
6
|
TABLE ACCESS FULL
|
EMP
|
4
|
52
|
3
(
)
|
00
:
00
:
01
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Predicate Information
(
identified by operation id
)
:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
5
-
access
(
"E"
.
"MGR"
=
"M"
.
"EMPNO"
)
filter
(
"E"
.
MGR
=
M
.
EMPNO"
)
6
-
filter
(
(
E
.
DEPTNO
=
20
AND
E
.
MGR
IS
NOT
NULL
)
)
可能路徑上的join order成本錯誤可能影響後邊整個的執行計劃。
還是那句話做sql調優沒必要看10053,我們關注的是merge錯的時候,或者沒做、不應該做的做了。
特別是報表系統view多的系統、常常出現transformation錯的情況
為什麼hj cost最小/*+opt_param("_bloom_fillter_enabled","false") */
不是所有的引數都可以這麼指定
與簡單檢視合併相關的引數
Parameter:
_simple_view_merging把這個引數關掉就不merge了
Hints:
/*+opt_param('_bloom_simple_view_merging',"false") */
no_query_transformation
少動
merge,no_merge
少動
這是關閉引數後的結果
有一些固定的原因是不做simple view merge的
1、view不是一個簡單的檢視
2、view出現在semi-j,anti-j的右邊(也不是一定的,需要關注一下)
3、view的select列表上包含子查詢。(也不是一定的,需要關注一下)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-1442114/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Transformation之CVM (complex view merge)【四】ORMView
- Transformation之JE(連線消除)【八】ORM
- Android自定義View之Window、ViewRootImpl和View的三大流程AndroidView
- 深入SQL之merge intoSQL
- Transformation之NUll-aware Anti-join(NAAJ)【九】ORMNull
- Transformation之FPD(filter push-down)的transform【一】ORMFilter
- 【Android自定義View】繪圖之文字篇(三)AndroidView繪圖
- 【sql調優之執行計劃】temp table transformationSQLORM
- BAdI: InfoSpoke with TransformationORM
- SQL入門之10 MERGESQL
- Core Animation 之 ViewView
- Star Transformation(星形轉換)ORM
- oracle之merge語法(轉載)Oracle
- 【sql調優之執行計劃】merge semi join and merge anti joinSQL
- 自定義View之SwitchViewView
- DRF之View和APIViewViewAPI
- Android View 原始碼解析(三) – View的繪製過程AndroidView原始碼
- Python資料分析之merge使用Python
- 【MySQL】效能優化之 index merge (1)MySql優化Index
- Transformation之Non-correlated(無關聯子查詢)=any的transform【五】ORM
- 自定義View之onMeasure()View
- Oracle simple streamOracle
- Android自定義View:ViewGroup(三)AndroidView
- Transformation之Subquery Un-nesting(子查詢的非巢狀)SU【六】ORM巢狀
- 【朝花夕拾】Android自定義View篇之(四)自定義View的三種實現方式及自定義屬性詳解AndroidView
- Qt 之 Graphics View Framework 簡介QTViewFramework
- 自定義View 之 RecyclerView.ItemDecorationView
- Android開發之View動畫AndroidView動畫
- Android GUI之View佈局AndroidGUIView
- Transformation HDU - 4578線段樹綜合操作ORM
- Java 8 中 Map 騷操作之 merge() 的用法Java
- 排序演算法之「歸併排序(Merge Sort)」排序演算法
- MySQL 優化之 index_merge (索引合併)MySql優化Index索引
- 佈局優化之ViewStub、Include、merge使用分析優化View
- Shrio(Simple,Java,Security)Java
- django-simple-captchaDjangoAPT
- simple Terracotta session 同步Session
- SAP Simple FinanceNaN