Commit 834bdfa1 authored by Sergey Petrunya's avatar Sergey Petrunya

Update test results for previous csets.

parent 41c766f3
...@@ -811,21 +811,6 @@ Percentage float(3,1) NOT NULL default '0.0', ...@@ -811,21 +811,6 @@ Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language), PRIMARY KEY (Country, Language),
INDEX (Percentage) INDEX (Percentage)
); );
explain
SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Country Country,Population 3,4 NULL 419 Using sort_union(Country,Population); Using where
SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
ID Name Country Population
65 Abu Dhabi ARE 398695
168 Pabna BGD 103277
189 Parakou BEN 103577
750 Paarl ZAF 105768
2865 Pak Pattan PAK 107800
SELECT * FROM City SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 102000); AND (Population > 101000 AND Population < 102000);
...@@ -839,13 +824,13 @@ SELECT * FROM City ...@@ -839,13 +824,13 @@ SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 102000); AND (Population > 101000 AND Population < 102000);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country Population 4 NULL 42 Using index condition; Using where; Rowid-ordered scan 1 SIMPLE City range Population,Country Population 4 NULL # Using index condition; Using where; Rowid-ordered scan
explain explain
SELECT * FROM City SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Country Country,Population 3,4 NULL 419 Using sort_union(Country,Population); Using where 1 SIMPLE City index_merge Population,Country Country,Population 3,4 NULL # Using sort_union(Country,Population); Using where
SELECT * FROM City SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
...@@ -864,12 +849,12 @@ explain ...@@ -864,12 +849,12 @@ explain
SELECT * FROM City SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 7000000; WHERE Name LIKE 'M%' AND Population > 7000000;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population Population 4 NULL 32 Using index condition; Using where; Rowid-ordered scan 1 SIMPLE City range Population Population 4 NULL # Using index condition; Using where; Rowid-ordered scan
explain explain
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country Population 4 NULL 520 Using index condition; Using where; Rowid-ordered scan 1 SIMPLE City range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
ID Name Country Population ID Name Country Population
...@@ -889,7 +874,7 @@ explain ...@@ -889,7 +874,7 @@ explain
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country Population 4 NULL 520 Using index condition; Using where; Rowid-ordered scan 1 SIMPLE City range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
ID Name Country Population ID Name Country Population
......
...@@ -400,10 +400,10 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -400,10 +400,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 4 test.t2.a 3 1 SIMPLE t1 ref a a 4 test.t2.a 3
explain select * from t1 where a=0 or a=2; explain select * from t1 where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Rowid-ordered scan 1 SIMPLE t1 range a a 4 NULL 4 Using where
explain select * from t1 force index (a) where a=0 or a=2; explain select * from t1 force index (a) where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Rowid-ordered scan 1 SIMPLE t1 range a a 4 NULL 4 Using where
explain select * from t1 where c=1; explain select * from t1 where c=1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c,c_2 c 5 const 1 1 SIMPLE t1 ref c,c_2 c 5 const 1
...@@ -1142,7 +1142,7 @@ qq ...@@ -1142,7 +1142,7 @@ qq
*a *a*a * *a *a*a *
explain select * from t1 where v='a'; explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition 1 SIMPLE t1 ref v,v_2 # 13 const # Using where
select v,count(*) from t1 group by v limit 10; select v,count(*) from t1 group by v limit 10;
v count(*) v count(*)
a 1 a 1
...@@ -1318,7 +1318,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1318,7 +1318,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 303 const # Using where; Using index 1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select * from t1 where v='a'; explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 303 const # Using index condition 1 SIMPLE t1 ref v v 303 const # Using where
select v,count(*) from t1 group by v limit 10; select v,count(*) from t1 group by v limit 10;
v count(*) v count(*)
a 1 a 1
......
...@@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4 ...@@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null; explain select id from t1 where uniq_id is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition 1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where
explain select id from t1 where uniq_id =1; explain select id from t1 where uniq_id =1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const idx1 idx1 5 const 1 1 SIMPLE t1 const idx1 idx1 5 const 1
......
...@@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr; EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
drop table t1,t2,t3; drop table t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
`titre` char(80) NOT NULL default '', `titre` char(80) NOT NULL default '',
......
...@@ -465,9 +465,9 @@ def key 253 64 7 Y 0 31 8 ...@@ -465,9 +465,9 @@ def key 253 64 7 Y 0 31 8
def key_len 253 4096 1 Y 0 31 8 def key_len 253 4096 1 Y 0 31 8
def ref 253 2048 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63 def rows 8 10 1 Y 32928 0 63
def Extra 253 255 57 N 1 31 8 def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Rowid-ordered scan; Using filesort 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
drop table if exists t2; drop table if exists t2;
create table t2 (id smallint, name varchar(20)) ; create table t2 (id smallint, name varchar(20)) ;
prepare stmt1 from ' insert into t2 values(?, ?) ' ; prepare stmt1 from ' insert into t2 values(?, ?) ' ;
......
...@@ -277,7 +277,7 @@ INSERT INTO t1 VALUES ...@@ -277,7 +277,7 @@ INSERT INTO t1 VALUES
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5); (33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where; Rowid-ordered scan 1 SIMPLE t1 range a,b a 5 NULL 2 Using where
SELECT * FROM t1 WHERE a IN(1,2) AND b=5; SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
a b a b
DROP TABLE t1; DROP TABLE t1;
...@@ -922,7 +922,7 @@ INSERT INTO t1 VALUES ...@@ -922,7 +922,7 @@ INSERT INTO t1 VALUES
('A2','2005-12-01 08:00:00',1000); ('A2','2005-12-01 08:00:00',1000);
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition 1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
item started price item started price
Warnings: Warnings:
......
...@@ -144,12 +144,12 @@ explain ...@@ -144,12 +144,12 @@ explain
select * from t1,t2 where t1.b=t2.c and d <= 100; select * from t1,t2 where t1.b=t2.c and d <= 100;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ref idx idx 5 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t2 ref idx idx 5 test.t1.b 2 Using where
select * from t1,t2 where t1.b=t2.c and d <= 100; select * from t1,t2 where t1.b=t2.c and d <= 100;
a b c d v a b c d v
3 30 30 100 101
4 20 20 100 101 4 20 20 100 101
1 20 20 100 101 1 20 20 100 101
3 30 30 100 101
set join_cache_level=default; set join_cache_level=default;
drop table t1, t2; drop table t1, t2;
create table t1 (a bigint, b bigint as (a > '2')); create table t1 (a bigint, b bigint as (a > '2'));
......
...@@ -44,7 +44,7 @@ a b c ...@@ -44,7 +44,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c>=-1; explain select * from t3 where c>=-1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 1 Using where
# select_type=SIMPLE, type=ref # select_type=SIMPLE, type=ref
select * from t1,t3 where t1.c=t3.c and t3.c=-1; select * from t1,t3 where t1.c=t3.c and t3.c=-1;
a b c a b c a b c a b c
...@@ -136,11 +136,11 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -136,11 +136,11 @@ id select_type table type possible_keys key key_len ref rows Extra
# SELECT * FROM tbl_name WHERE <vcol expr> # SELECT * FROM tbl_name WHERE <vcol expr>
select * from t3 where c >= -2; select * from t3 where c >= -2;
a b c a b c
1 -1 -1
2 -2 -2 2 -2 -2
1 -1 -1
explain select * from t3 where c >= -2; explain select * from t3 where c >= -2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 1 Using where
# SELECT * FROM tbl_name WHERE <non-vcol expr> # SELECT * FROM tbl_name WHERE <non-vcol expr>
select * from t3 where a between 1 and 2; select * from t3 where a between 1 and 2;
a b c a b c
...@@ -160,11 +160,11 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -160,11 +160,11 @@ id select_type table type possible_keys key key_len ref rows Extra
# SELECT * FROM tbl_name WHERE <indexed vcol expr> # SELECT * FROM tbl_name WHERE <indexed vcol expr>
select * from t3 where c between -2 and -1; select * from t3 where c between -2 and -1;
a b c a b c
1 -1 -1
2 -2 -2 2 -2 -2
1 -1 -1
explain select * from t3 where c between -2 and -1; explain select * from t3 where c between -2 and -1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 1 Using where
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol> # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol>
select * from t3 where a between 1 and 2 order by b; select * from t3 where a between 1 and 2 order by b;
a b c a b c
...@@ -204,7 +204,7 @@ a b c ...@@ -204,7 +204,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c between -2 and -1 order by b; explain select * from t3 where c between -2 and -1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan; Using filesort 1 SIMPLE t3 range c c 5 NULL 1 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol> # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
select * from t3 where b between -2 and -1 order by c; select * from t3 where b between -2 and -1 order by c;
a b c a b c
...@@ -220,7 +220,7 @@ a b c ...@@ -220,7 +220,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c between -2 and -1 order by c; explain select * from t3 where c between -2 and -1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition 1 SIMPLE t3 range c c 5 NULL 1 Using where
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
select sum(b) from t1 group by b; select sum(b) from t1 group by b;
sum(b) sum(b)
......
...@@ -44,7 +44,7 @@ a b c ...@@ -44,7 +44,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c>=-1; explain select * from t3 where c>=-1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 2 Using where
# select_type=SIMPLE, type=ref # select_type=SIMPLE, type=ref
select * from t1,t3 where t1.c=t3.c and t3.c=-1; select * from t1,t3 where t1.c=t3.c and t3.c=-1;
a b c a b c a b c a b c
...@@ -140,15 +140,15 @@ a b c ...@@ -140,15 +140,15 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c >= -2; explain select * from t3 where c >= -2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 2 Using where
# SELECT * FROM tbl_name WHERE <non-vcol expr> # SELECT * FROM tbl_name WHERE <non-vcol expr>
select * from t3 where a between 1 and 2; select * from t3 where a between 1 and 2;
a b c a b c
2 -2 -2
1 -1 -1 1 -1 -1
2 -2 -2
explain select * from t3 where a between 1 and 2; explain select * from t3 where a between 1 and 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> # SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
select * from t3 where b between -2 and -1; select * from t3 where b between -2 and -1;
a b c a b c
...@@ -164,7 +164,7 @@ a b c ...@@ -164,7 +164,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c between -2 and -1; explain select * from t3 where c between -2 and -1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan 1 SIMPLE t3 range c c 5 NULL 1 Using where
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol> # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
select * from t3 where a between 1 and 2 order by c; select * from t3 where a between 1 and 2 order by c;
a b c a b c
...@@ -172,7 +172,7 @@ a b c ...@@ -172,7 +172,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where a between 1 and 2 order by c; explain select * from t3 where a between 1 and 2 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan; Using filesort 1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol> # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
select * from t3 where b between -2 and -1 order by a; select * from t3 where b between -2 and -1 order by a;
a b c a b c
...@@ -188,7 +188,7 @@ a b c ...@@ -188,7 +188,7 @@ a b c
2 -2 -2 2 -2 -2
explain select * from t3 where c between -2 and -1 order by a; explain select * from t3 where c between -2 and -1 order by a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan; Using filesort 1 SIMPLE t3 range c c 5 NULL 1 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol> # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol>
select * from t3 where b between -2 and -1 order by b; select * from t3 where b between -2 and -1 order by b;
a b c a b c
...@@ -204,7 +204,7 @@ a b c ...@@ -204,7 +204,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c between -2 and -1 order by b; explain select * from t3 where c between -2 and -1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Rowid-ordered scan; Using filesort 1 SIMPLE t3 range c c 5 NULL 1 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol> # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
select * from t3 where b between -2 and -1 order by c; select * from t3 where b between -2 and -1 order by c;
a b c a b c
...@@ -220,7 +220,7 @@ a b c ...@@ -220,7 +220,7 @@ a b c
1 -1 -1 1 -1 -1
explain select * from t3 where c between -2 and -1 order by c; explain select * from t3 where c between -2 and -1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range c c 5 NULL 1 Using index condition 1 SIMPLE t3 range c c 5 NULL 1 Using where
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
select sum(b) from t1 group by b; select sum(b) from t1 group by b;
sum(b) sum(b)
......
...@@ -189,24 +189,17 @@ use world; ...@@ -189,24 +189,17 @@ use world;
--enable_result_log --enable_result_log
--enable_query_log --enable_query_log
explain
SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
SELECT * FROM City SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 102000); AND (Population > 101000 AND Population < 102000);
--replace_column 9 #
explain explain
SELECT * FROM City SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 102000); AND (Population > 101000 AND Population < 102000);
--replace_column 9 #
explain explain
SELECT * FROM City SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
...@@ -219,16 +212,19 @@ WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR ...@@ -219,16 +212,19 @@ WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
SELECT * FROM City SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 7000000; WHERE Name LIKE 'M%' AND Population > 7000000;
--replace_column 9 #
explain explain
SELECT * FROM City SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 7000000; WHERE Name LIKE 'M%' AND Population > 7000000;
--replace_column 6 # 7 # 9 #
explain explain
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
--replace_column 6 # 7 # 9 #
explain explain
SELECT * FROM City SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment