• unknown's avatar
    BUG#16590: Optimized does not do right "const" table pre-read · 2c6e678d
    unknown authored
     st_table::const_key_parts member is used in determining if
     certain key has a prefix that is compared to constant(s) in
     the query predicates.
     If there's such prefix the index can be used to get the data
     from the remaining suffix columns in sorted order.
     However if a field is compared to another field from a "const"
     table the const_key_parts is not amended.
     This makes the optimizer unable to detect that the key can be 
     used for sorting and adds an extra filesort.
     Fixed by updating const_key_parts after reading in the "const"
     table.
    
    
    mysql-test/r/order_by.result:
      BUG#16590: Optimized does not do right "const" table pre-read
       - test case
    mysql-test/t/order_by.test:
      BUG#16590: Optimized does not do right "const" table pre-read
       - test case
    sql/sql_select.cc:
      BUG#16590: Optimized does not do right "const" table pre-read
       - fill up the const_key_parts structure
    2c6e678d
order_by.test 22.6 KB