summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-07-20 21:05:29 +0300
committergkodinov/kgeorge@magare.gmz <>2007-07-20 21:05:29 +0300
commit8fc401e21fc3560a1c50fe24504d713e49e72e2d (patch)
tree48365c1e22c96fda3210f58953eab90424151b54 /sql/table.cc
parent17654758a4198761b0a91bef4e93441724b951aa (diff)
downloadmariadb-git-8fc401e21fc3560a1c50fe24504d713e49e72e2d.tar.gz
Bug #28591: MySQL need not sort the records in case of
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.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 4e0f2b5d287..8cfd206a74f 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -780,7 +780,11 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
the primary key, then we can use any key to find this column
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
+ {
field->part_of_key= share->keys_in_use;
+ if (field->part_of_sortkey.is_set(key))
+ field->part_of_sortkey= share->keys_in_use;
+ }
}
if (field->key_length() != key_part->length)
{