• Igor Babaev's avatar
    MDEV-16934 Query with very large IN clause lists runs slowly · 4eac5df3
    Igor Babaev authored
    This patch introduces support for the system variable eq_range_index_dive_limit
    that existed in MySQL starting from 5.6. The variable sets a limit for
    index dives into equality ranges. Index dives are performed by optimizer
    to estimate the number of rows in range scans. Index dives usually provide
    good estimate but they are pretty expensive. To estimate the number of rows
    in equality ranges statistical data on indexes can be employed. Its usage gives
    not so good estimates but it's cheap. So if the number of equality dives
    required by an index scan exceeds the set limit no dives for equality
    ranges are performed by the optimizer for this index.
    
    As the new system variable is introduced in a stable version the default
    value for it is set to a special value meaning there is no limit for the number
    of index dives performed by the optimizer.
    
    The patch partially uses the MySQL code for WL 5957
    'Statistics-based Range optimization for many ranges'.
    4eac5df3
range.result 99.5 KB