• Igor Babaev's avatar
    MDEV-23811: With large number of indexes optimizer chooses an inefficient plan · 291be494
    Igor Babaev authored
    This bug could manifest itself for a query with WHERE condition containing
    top level OR formula such that each conjunct contained a single-range
    condition supported by the same index. One of these range conditions must
    be fully covered by another range condition that is used later in the OR
    formula. Additionally at least one of these condition should be ANDed with
    a sargable range condition supported by a different index.
    
    There were several attempts to fix related problems for OR conditions after
    the backport of range optimizer code from MySQL (commit
    0e19f3e3). Unfortunately the first of these
    fixes contained typo remained unnoticed until recently. This typo bug led
    to rejection of valid range accesses. This patch fixed this typo bug.
    The fix revealed another two bugs: one in a constructor for SEL_ARG,
    the other in the function tree_or(). Both are fixed in this patch.
    291be494
range_vs_index_merge_innodb.result 67.2 KB