diff options
author | Igor Babaev <igor@askmonty.org> | 2020-03-12 23:50:20 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2020-03-13 09:11:01 -0700 |
commit | 5af12e463549e4bbc2ce6ab720d78937d5e5db4e (patch) | |
tree | 81588ea38fbc6f603a6cacaaba59beabaf66800a /sql/opt_range.cc | |
parent | 3ab33c6c929ca615e73465f638a96bdec74adfcf (diff) | |
download | mariadb-git-5af12e463549e4bbc2ce6ab720d78937d5e5db4e.tar.gz |
MDEV-21932 A fast plan with ROR index-merge is ignored when
'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.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ca6f500fec6..70c1786dd83 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -6802,6 +6802,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, update_tbl_stats, &mrr_flags, &buf_size, &cost); + if (!param->is_ror_scan && + !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) + { + /* The scan is not a ROR-scan, just skip it */ + continue; + } + if (found_records != HA_POS_ERROR && tree->index_scans && (index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root, sizeof(INDEX_SCAN_INFO)))) |