• unknown's avatar
    Bug #28591: MySQL need not sort the records in case of · 95a8c6c3
    unknown authored
    ORDER BY primary_key on InnoDB table
    
    Queries that use an InnoDB secondary index to retrieve
    data don't need to sort in case of ORDER BY primary key
    if the secondary index is compared to constant(s).
    They can also skip sorting if ORDER BY contains both the
    the secondary key parts and the primary key parts (in
    that order).
    This is because InnoDB returns the rows in order of the
    primary key for rows with the same values of the secondary
    key columns.
    Fixed by preventing temp table sort for the qualifying 
    queries.
    
    
    mysql-test/r/innodb_mysql.result:
      Bug #28591: test case
    mysql-test/t/innodb_mysql.test:
      Bug #28591: test case
    sql/sql_select.cc:
      Bug #28591: Use the primary key as suffix when testing
      if the key can be used for ORDER BY on supporting engines.
    sql/table.cc:
      Bug #28591: can use the primary key
      as a suffix for the secondary keys
    95a8c6c3
table.cc 88.6 KB