From 59ab9a0872ab5e91cc85da55ee610a6d6f6bcf0c Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 16 Jul 2008 12:31:50 +0300 Subject: Bug#37830 : ORDER BY ASC/DESC - no difference Range scan in descending order for c <= <= 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. --- sql/opt_range.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sql/opt_range.h') diff --git a/sql/opt_range.h b/sql/opt_range.h index 3a737323eb7..8856223b371 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -667,12 +667,10 @@ public: int get_type() { return QS_TYPE_RANGE_DESC; } private: bool range_reads_after_key(QUICK_RANGE *range); -#ifdef NOT_USED - bool test_if_null_range(QUICK_RANGE *range, uint used_key_parts); -#endif int reset(void) { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); } List rev_ranges; List_iterator rev_it; + uint used_key_parts; }; -- cgit v1.2.1