Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.5.25, 10.6.18, 10.11.8, 11.6(EOL)
Description
The optimizer can perform a range scan and build a SEL_TREE.
When attempting to allocate more than optimizer_max_sel_args (thd->variables.optimizer_max_sel_args), Item_cond::get_mm_tree() will abort all range scans and potentially revert to a full table scan.
This issue is created to explore more useful alternatives to this.
Attachments
Issue Links
- relates to
-
MDEV-34620 Large N-way OR causes a lot of index_merge variants to be created and discarded
-
- Closed
-
One obvious improvement to my suggested patch is to choose which key to remove, rather than the easiest (which is the last one).
Questions
1) how are key_parts ordered?
2) how do we know which key might be best to deactivate?
Shortest? Longest? Coverage?
What are optimal conditions for an index merge?
Having 2 keys mostly similar has showing itself to be terrible, so perhaps we need to compare keys to each other and deactivate one that is most like another one.
Speaking with sanja_byelkin, the idea of free-ing up memory isn't applicable, so we are stuck with these objects left in memory until the statement has finished executing. This isn't terribly great in the context of prepared statements/SP <check this>.
Perhaps we might be able to estimate how many SEL_ARGS we are going to allocate and trim used keys first.