diff options
author | unknown <gkodinov/kgeorge@macbook.local> | 2006-10-09 19:51:41 +0400 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.local> | 2006-10-09 19:51:41 +0400 |
commit | 45cad70ff4b9e191e9ac553298e25fe500a747c5 (patch) | |
tree | 073ea6f39d3e03cc1ad7bb39aefbe30ed6f415ab /mysql-test/t/group_by.test | |
parent | 04bf9cc7c6f17d9c6ab14a7521c1ab1708f50993 (diff) | |
download | mariadb-git-45cad70ff4b9e191e9ac553298e25fe500a747c5.tar.gz |
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
Currently SQL_BIG_RESULT is checked only at compile time.
However, additional optimizations may take place after
this check that change the sort method from 'filesort'
to sorting via index. As a result the actual plan
executed is not the one specified by the SQL_BIG_RESULT
hint. Similarly, there is no such test when executing
EXPLAIN, resulting in incorrect output.
The patch corrects the problem by testing for
SQL_BIG_RESULT both during the explain and execution
phases.
mysql-test/r/bdb.result:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- updated sql_big_result testcase
mysql-test/r/group_by.result:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- test case with MyISAM
mysql-test/r/innodb.result:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- updated sql_big_result testcase
mysql-test/r/innodb_mysql.result:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- test case with InnoDB
mysql-test/r/myisam.result:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- updated sql_big_result testcase
mysql-test/t/group_by.test:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- test case with MyISAM
mysql-test/t/innodb_mysql.test:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- test case with InnoDB
sql/sql_select.cc:
Bug #22781: SQL_BIG_RESULT fails to influence sort plan
- When SQL_BIG_RESULT is specified, disable the optimization performed
at execution/explain time that decides to use an index instead
of filesort.
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r-- | mysql-test/t/group_by.test | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index ce1e4e59600..5d47f64f3d1 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -655,3 +655,25 @@ where t2.b=v1.a GROUP BY t2.b; DROP VIEW v1; DROP TABLE t1,t2; + +# +# Bug#22781: SQL_BIG_RESULT fails to influence sort plan +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, key (b)); + +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20) FROM t1; +INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20) FROM t1; +INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20) FROM t1; +INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20) FROM t1; +INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20) FROM t1; +INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20) FROM t1; +INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20) FROM t1; + +SELECT MIN(b), MAX(b) from t1; + +EXPLAIN SELECT b, sum(1) FROM t1 GROUP BY b; +EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b; +SELECT b, sum(1) FROM t1 GROUP BY b; +SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b; +DROP TABLE t1; |