• Monty's avatar
    Fixed wrong selectivity calculation in table_after_join_selectivity() · b5df077e
    Monty authored
    The old code counted selectivity double in case of queries like:
    WHERE key_part1=1 and key_part2 < 100
    if the optimizer would decide to use a REF access on key_part1.
    
    The new code in best_access_path() that changes REF access to RANGE
    if the RANGE key is longer makes this issue less likely to happen.
    
    I was not able to create a test case for 11.0, however if one ports this
    patch to a MariaDB version without the change of REF to RANGE, the
    selectivity will be counted double.
    b5df077e
sql_select.cc 1.01 MB