• Alexey Kopytov's avatar
    Bug #48472: Loose index scan inappropriately chosen for some · 8cfa50e6
    Alexey Kopytov authored
                WHERE conditions 
     
    check_group_min_max() checks if the loose index scan 
    optimization is applicable for a given WHERE condition, that is 
    if the MIN/MAX attribute participates only in range predicates 
    comparing the corresponding field with constants. 
     
    The problem was that it considered the whole predicate suitable 
    for the loose index scan optimization as soon as it encountered 
    a constant as a predicate argument. This is obviously wrong for 
    cases when a constant is the first argument of a predicate 
    which does not satisfy the above condition. 
     
    Fixed check_group_min_max() so that all arguments of the input 
    predicate are considered to decide if it passes the test, even 
    though a constant has already been encountered.
    
    mysql-test/r/group_min_max.result:
      Added a test case for bug #48472.
    mysql-test/t/group_min_max.test:
      Added a test case for bug #48472.
    sql/opt_range.cc:
      Fixed check_group_min_max() so that all arguments of the input 
      predicate are considered to decide if it passes the test, even 
      though a constant has already been encountered.
    8cfa50e6
group_min_max.test 49.1 KB