• gkodinov/kgeorge@magare.gmz's avatar
    Bug #28591: MySQL need not sort the records in case of · 8fc401e2
    gkodinov/kgeorge@magare.gmz 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.
    8fc401e2
table.cc 88.6 KB