diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-04-16 14:46:16 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-04-16 14:46:16 +0530 |
commit | 18656797de2c10f7539f99b257cdf093056d9ad9 (patch) | |
tree | e70e9cad73142180a29625e2472bf02a23df2c6e | |
parent | f8166a05af085aeb22be8bc1f41bac9affe4a96f (diff) | |
parent | b7cfd197591bb69a292bd610a650f004d6a29565 (diff) | |
download | mariadb-git-18656797de2c10f7539f99b257cdf093056d9ad9.tar.gz |
Merge branch '5.5' into 10.1
-rw-r--r-- | sql/opt_range.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index fd014802c06..92268ba69aa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -4686,6 +4686,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, double roru_index_costs; ha_rows roru_total_records; double roru_intersect_part= 1.0; + bool only_ror_scans_required= FALSE; DBUG_ENTER("get_best_disjunct_quick"); DBUG_PRINT("info", ("Full table scan cost: %g", read_time)); @@ -4711,6 +4712,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, sizeof(TRP_RANGE*)* n_child_scans))) DBUG_RETURN(NULL); + + only_ror_scans_required= !optimizer_flag(param->thd, + OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION); /* Collect best 'range' scan for each of disjuncts, and, while doing so, analyze possibility of ROR scans. Also calculate some values needed by @@ -4723,7 +4727,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map, "tree in SEL_IMERGE");); if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, - read_time, TRUE))) + read_time, + only_ror_scans_required))) { /* One of index scans in this index_merge is more expensive than entire @@ -5045,7 +5050,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge, index merge retrievals are not well calibrated */ trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, - read_time, TRUE); + read_time, FALSE); } DBUG_RETURN(trp); @@ -6773,7 +6778,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, index_read_must_be_used if TRUE, assume 'index only' option will be set (except for clustered PK indexes) read_time don't create read plans with cost > read_time. - ror_scans_required set to TRUE for index merge + only_ror_scans_required set to TRUE when we are only interested + in ROR scan RETURN Best range read plan NULL if no plan found or error occurred @@ -6783,7 +6789,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, bool update_tbl_stats, double read_time, - bool ror_scans_required) + bool only_ror_scans_required) { uint idx, best_idx; SEL_ARG *key_to_read= NULL; @@ -6831,8 +6837,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, update_tbl_stats, &mrr_flags, &buf_size, &cost); - if (ror_scans_required && !param->is_ror_scan && - !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) + if (only_ror_scans_required && !param->is_ror_scan) { /* The scan is not a ROR-scan, just skip it */ continue; |