summaryrefslogtreecommitdiff
path: root/sql/opt_range.h
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-07-16 12:31:50 +0300
committerGeorgi Kodinov <kgeorge@mysql.com>2008-07-16 12:31:50 +0300
commit340134ac2fd5c70036d53ada2da3ca32cdaa1843 (patch)
treea6746e285208320fb4096bebcf7c4450dd5b6146 /sql/opt_range.h
parentd5077086f73cfa24b8c4c9451fb70bc5a77922ae (diff)
downloadmariadb-git-340134ac2fd5c70036d53ada2da3ca32cdaa1843.tar.gz
Bug#37830 : ORDER BY ASC/DESC - no difference
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.
Diffstat (limited to 'sql/opt_range.h')
-rw-r--r--sql/opt_range.h4
1 files changed, 1 insertions, 3 deletions
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<QUICK_RANGE> rev_ranges;
List_iterator<QUICK_RANGE> rev_it;
+ uint used_key_parts;
};