summaryrefslogtreecommitdiff
path: root/mysql-test/t/group_by.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r--mysql-test/t/group_by.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 531cec6b730..18e244d8152 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -996,8 +996,33 @@ EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
+
+--echo #
+--echo # For this explain, the query plan is weird: if we are using
+--echo # the primary key for reasons other than doing grouping, can't
+--echo # GROUP BY code take advantage of this? Well, currently it doesnt:
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+--echo # Here's a proof it is really doing sorting:
+flush status;
+--disable_result_log
+SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+--enable_result_log
+show status like 'Sort_%';
+--echo # Proof ends.
+--echo #
+
+--echo # For this explain, the query plan is weird: if we are using
+--echo # the primary key for reasons other than doing sorting, can't
+--echo # ORDER BY code take advantage of this? Well, currently it doesnt:
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+--echo # Here's a proof it is really doing sorting:
+flush status;
+--disable_result_log
+SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+--enable_result_log
+show status like 'Sort_%';
+--echo # Proof ends.
+--echo #
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;