summaryrefslogtreecommitdiff
path: root/sql/opt_range.h
diff options
context:
space:
mode:
authortim@white.box <>2001-06-28 03:06:23 -0400
committertim@white.box <>2001-06-28 03:06:23 -0400
commit5ed2cf7dbedfce5b8f408bac5955f1b5c12af3ab (patch)
tree8e1c3a62991f2a6d938de086708b15282d727add /sql/opt_range.h
parent85388703c400d4a952085a8ed547494bd20863a2 (diff)
downloadmariadb-git-5ed2cf7dbedfce5b8f408bac5955f1b5c12af3ab.tar.gz
Implement ORDER BY DESC optimization, which reads values in descending
order directly from the index instead of using a filesort.
Diffstat (limited to 'sql/opt_range.h')
-rw-r--r--sql/opt_range.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 247dd260817..0c8dcf7fed3 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -80,6 +80,20 @@ public:
bool unique_key_range();
};
+class QUICK_SELECT_DESC: public QUICK_SELECT
+{
+public:
+ QUICK_SELECT_DESC(QUICK_SELECT *q);
+ int get_next();
+private:
+ int cmp_prev(QUICK_RANGE *range);
+ bool range_reads_after_key(QUICK_RANGE *range);
+
+ QUICK_SELECT *quick;
+ List<QUICK_RANGE> rev_ranges;
+ List_iterator<QUICK_RANGE> rev_it;
+};
+
class SQL_SELECT :public Sql_alloc {
public:
QUICK_SELECT *quick; // If quick-select used