~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/group_min_max.result

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
create index idx_t1_2 on t1 (a1,a2,b);
41
41
analyze table t1;
42
42
Table   Op      Msg_type        Msg_text
43
 
test.t1 analyze note    The storage engine for the table doesn't support analyze
 
43
test.t1 analyze status  Table is already up to date
44
44
drop table if exists t2;
45
45
create TEMPORARY table t2 (
46
46
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
68
68
create index idx_t2_2 on t2 (a1,a2,b);
69
69
analyze table t2;
70
70
Table   Op      Msg_type        Msg_text
71
 
test.t2 analyze note    The storage engine for the table doesn't support analyze
 
71
test.t2 analyze status  Table is already up to date
72
72
drop table if exists t3;
73
73
create TEMPORARY table t3 (
74
74
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
130
130
create index idx_t3_2 on t3 (a1,a2,b);
131
131
analyze table t3;
132
132
Table   Op      Msg_type        Msg_text
133
 
test.t3 analyze note    The storage engine for the table doesn't support analyze
 
133
test.t3 analyze status  Table is already up to date
134
134
explain select a1, min(a2) from t1 group by a1;
135
135
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
136
136
1       SIMPLE  t1      range   NULL    idx_t1_1        518     NULL    5       Using index for group-by
1608
1608
b       c       b       c
1609
1609
a       d       a       d
1610
1610
b       d       b       d
1611
 
select distinct t1.a1,t2.a1 from t1,t2 where t1.a1 >= '';
 
1611
select distinct t1.a1,t2.a1 from t1,t2;
1612
1612
a1      a1
1613
1613
a       a
 
1614
b       a
 
1615
c       a
 
1616
d       a
1614
1617
a       b
 
1618
b       b
 
1619
c       b
 
1620
d       b
1615
1621
a       c
 
1622
b       c
 
1623
c       c
 
1624
d       c
1616
1625
a       d
 
1626
b       d
 
1627
c       d
 
1628
d       d
1617
1629
a       e
1618
 
b       a
1619
 
b       b
1620
 
b       c
1621
 
b       d
1622
1630
b       e
1623
 
c       a
1624
 
c       b
1625
 
c       c
1626
 
c       d
1627
1631
c       e
1628
 
d       a
1629
 
d       b
1630
 
d       c
1631
 
d       d
1632
1632
d       e
1633
1633
explain select distinct a1,a2,b from t1;
1634
1634
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1965
1965
drop table t1;
1966
1966
CREATE TABLE t1 (a varchar(5), b int, PRIMARY KEY (a,b));
1967
1967
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
1968
 
ALTER TABLE t1 ENGINE="DEFAULT";
 
1968
OPTIMIZE TABLE t1;
 
1969
Table   Op      Msg_type        Msg_text
 
1970
test.t1 optimize        status  OK
1969
1971
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
1970
1972
a
1971
1973
AA
1974
1976
BB
1975
1977
EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
1976
1978
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1977
 
1       SIMPLE  t1      ref     PRIMARY PRIMARY 22      const   4       Using where; Using index
 
1979
1       SIMPLE  t1      ref     PRIMARY PRIMARY 22      const   2       Using where; Using index
1978
1980
EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
1979
1981
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1980
1982
1       SIMPLE  t1      ref     PRIMARY PRIMARY 22      const   1       Using where; Using index
2120
2122
6       4
2121
2123
SHOW STATUS LIKE 'handler_read__e%';
2122
2124
Variable_name   Value
2123
 
Handler_read_key        23
 
2125
Handler_read_key        22
2124
2126
Handler_read_next       0
2125
2127
EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION 
2126
2128
(SELECT max(b), a FROM t1 GROUP BY a);
2171
2173
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
2172
2174
SHOW STATUS LIKE 'handler_read__e%';
2173
2175
Variable_name   Value
2174
 
Handler_read_key        12
 
2176
Handler_read_key        11
2175
2177
Handler_read_next       0
2176
2178
DELETE FROM t3;
2177
2179
FLUSH STATUS;