diff options
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r-- | mysql-test/r/group_by.result | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index d0b4ab4efff..a0e234aa69c 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -216,3 +216,50 @@ select 1+1,"a",count(*) from t1 where foo in (2); 1+1 a count(*) 2 a 0 drop table t1; +CREATE TABLE t1 ( +spID int(10) unsigned, +userID int(10) unsigned, +score smallint(5) unsigned, +key (spid), +key (score) +); +INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); +explain select userid,count(*) from t1 group by userid desc; +table type possible_keys key key_len ref rows Extra +t1 ALL NULL NULL NULL NULL 6 Using temporary +select userid,count(*) from t1 group by userid desc; +userid count(*) +3 3 +2 1 +1 2 +explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; +table type possible_keys key key_len ref rows Extra +t1 range spID spID 5 NULL 2 where used; Using index +explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; +table type possible_keys key key_len ref rows Extra +t1 range spID spID 5 NULL 2 where used; Using index +select spid,count(*) from t1 where spid between 1 and 2 group by spid; +spid count(*) +1 1 +2 2 +select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; +spid count(*) +explain select sql_big_result spid,sum(userid) from t1 group by spid desc; +table type possible_keys key key_len ref rows Extra +t1 ALL NULL NULL NULL NULL 6 Using filesort +select sql_big_result spid,sum(userid) from t1 group by spid desc; +spid sum(userid) +5 3 +4 3 +3 3 +2 3 +1 1 +explain select sql_big_result score,count(*) from t1 group by score desc; +table type possible_keys key key_len ref rows Extra +t1 index NULL score 3 NULL 6 Using index +select sql_big_result score,count(*) from t1 group by score desc; +score count(*) +3 3 +2 1 +1 2 +drop table t1; |