diff options
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r-- | mysql-test/t/group_by.test | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 4b992faa306..531cec6b730 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -394,6 +394,7 @@ select a,count(*) from t1 group by a; set big_tables=1; select a,count(*) from t1 group by a; drop table t1; +set big_tables=0; # # Test of GROUP BY ... ORDER BY NULL optimization @@ -485,9 +486,12 @@ create table t1 (a integer, b integer, c integer); insert into t1 (a,b) values (1,2),(1,3),(2,5); select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; # rand(100)*10 will be < 2 only for the first row (of 6) -select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2; +select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2; +select a, round(rand(100)*10) r2, sum(1) r1 from t1 group by a having r1>1 and r2<=2; select a,sum(b) from t1 where a=1 group by c; select a*sum(b) from t1 where a=1 group by c; +select a*sum(b) as f1 from t1 where a=1 group by c having f1 <= 10; +select a,a*sum(b) as f1 from t1 where a=1 group by c having a*sum(b)+0 <= 10; select sum(a)*sum(b) from t1 where a=1 group by c; select a,sum(b) from t1 where a=1 group by c having a=1; select a as d,sum(b) from t1 where a=1 group by c having d=1; @@ -1346,9 +1350,9 @@ let $query=SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2; # Needs to be range to exercise bug ---eval EXPLAIN $query; +--eval EXPLAIN $query FLUSH STATUS; ---eval $query; +--eval $query SHOW SESSION STATUS LIKE 'Sort_scan%'; CREATE VIEW v1 AS SELECT * FROM t1; @@ -1369,6 +1373,14 @@ select col1 f1, col1 f2 from t1 order by f2, f1+0; select col1 f1, col1 f2 from t1 order by f2, f1+0; explain +select col1 f1, col1 f2 from t1 group by f1; +select col1 f1, col1 f2 from t1 group by f1; + +explain +select col1 f1, col1 f2 from t1 group by f1, f2; +select col1 f1, col1 f2 from t1 group by f1, f2; + +explain select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; @@ -1376,6 +1388,7 @@ explain select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; + CREATE TABLE t2( col1 int, col2 int, @@ -1386,10 +1399,21 @@ INSERT INTO t2(col1, col2) VALUES (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +explain +select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1; +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2; +explain +select col1 f1, col1 f2 from t2 group by f1, 1+1; + +explain select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; explain +select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2; +explain select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; |