MySQL 8.0.40
Source Code Documentation
|
Represents a candidate index merge, ie. More...
Public Attributes | |
SEL_IMERGE * | imerge |
size_t | pred_idx |
bool | inexact |
Represents a candidate index merge, ie.
an OR expression of several range scans across different indexes (that can be reconciled by doing deduplication by sorting on row IDs).
Each predicate (in our usual sense of “part of a top-level AND conjunction in WHERE”) can give rise to multiple index merges (if there are AND conjunctions within ORs), but one index merge arises from exactly one predicate. This is not an inherent limitation, but it is how tree_and() does it; if it takes two SEL_TREEs with index merges, it just combines their candidates wholesale; each will deal with one predicate, and the other one would just have to be applied as a filter.
This is obviously suboptimal, as there are many cases where we could do better. Imagine something like (a = 3 OR b > 3) AND b <= 5, with separate indexes on a and b; obviously, we could have applied this as a single index merge between two range scans: (a = 3 AND b <= 5) OR (b > 3 AND b <= 5). But this is probably not a priority for us, so we follow the range optimizer's lead here and record each index merge as covering a separate, single predicate.
SEL_IMERGE* anonymous_namespace{join_optimizer.cc}::PossibleIndexMerge::imerge |
bool anonymous_namespace{join_optimizer.cc}::PossibleIndexMerge::inexact |
size_t anonymous_namespace{join_optimizer.cc}::PossibleIndexMerge::pred_idx |