• Georgi Kodinov's avatar
    Bug#37830 : ORDER BY ASC/DESC - no difference · 340134ac
    Georgi Kodinov authored
                
    Range scan in descending order for c <= <col> <= c type of
    ranges was ignoring the DESC flag.
    However some engines like InnoDB have the primary key parts 
    as a suffix for every secondary key.
    When such primary key suffix is used for ordering ignoring 
    the DESC is not valid.
    But we generally would like to do this because it's faster.
          
    Fixed by performing only reverse scan if the primary key is used.
    Removed some dead code in the process.
    
    mysql-test/r/innodb_mysql.result:
      Bug#37830 : test case
    mysql-test/t/innodb_mysql.test:
      Bug#37830 : test case
    sql/opt_range.cc:
      Bug#37830 : 
       - preserve and use used_key_parts to
         distinguish when a primary key suffix is used
       - removed some dead code
    sql/opt_range.h:
      Bug#37830 : 
        - preserve used_key_parts
        - dead code removed
    sql/sql_select.cc:
      Bug#37830 : Do only reverse order traversal
          if the primary key suffix is used.
    340134ac
innodb_mysql.test 30.5 KB