summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2020-03-13 15:55:32 +0200
committerMonty <monty@mariadb.org>2020-03-17 02:16:49 +0200
commita2d24def8cc42d27c72d833abfb39ef24a2b96ba (patch)
tree9977464e6dc96483242a224d559d2e5718a68596 /sql/opt_range.cc
parent1242eb3d32f2863f847aa96a10e2ab983a1a643b (diff)
downloadmariadb-git-a2d24def8cc42d27c72d833abfb39ef24a2b96ba.tar.gz
MDEV-21932 A fast plan with ROR index-merge is ignored whenbb-10.4-monty3
'index_merge_sort_union=off' When index_merge_sort_union is set to 'off' and index_merge_union is set to 'on' then any evaluated index merge scan must consist only of ROR scans. The cheapest out of such index merges must be chosen. This index merge might not be the cheapest index merge.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 4a7bbd9770b..0528dfcadc6 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7386,6 +7386,9 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
found_records= check_quick_select(param, idx, read_index_only, key,
update_tbl_stats, &mrr_flags,
&buf_size, &cost, &is_ror_scan);
+ if (!is_ror_scan &&
+ !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
+ continue;
if (found_records != HA_POS_ERROR && tree->index_scans &&
(index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root,