explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
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 FIRST Impossible WHERE
1 SIMPLE Impossible WHERE
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
...
@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
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 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
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 FIRST t2 index NULL fld3 30 NULL 1199 where used; Using index
1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
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 FIRST t2 index NULL fld3 30 NULL 1199 where used; Using index
1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
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 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
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 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
explain select fld3 from t2 use index (not_used);
...
@@ -1351,7 +1351,7 @@ honeysuckle
...
@@ -1351,7 +1351,7 @@ honeysuckle
honoring
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
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 FIRST t2 range fld3 fld3 30 NULL 2 where used; Using index
1 SIMPLE t2 range fld3 fld3 30 NULL 2 where used; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
fld1 fld3
148504 Colombo
148504 Colombo
...
@@ -1371,7 +1371,7 @@ fld1
...
@@ -1371,7 +1371,7 @@ fld1
250502
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
explain select fld1 from t2 where fld1=250501 or fld1="250502";
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 FIRST t2 range fld1 fld1 4 NULL 2 where used; Using index
1 SIMPLE t2 range fld1 fld1 4 NULL 2 where used; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
fld1
250501
250501
...
@@ -1380,7 +1380,7 @@ fld1
...
@@ -1380,7 +1380,7 @@ fld1
250601
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
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 FIRST t2 range fld1 fld1 4 NULL 4 where used; Using index
1 SIMPLE t2 range fld1 fld1 4 NULL 4 where used; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
fld1 fld3
218401 faithful
218401 faithful
...
@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
...
@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
fld3
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
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 FIRST t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
1 FIRST t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
select period from t1;
select period from t1;
period
period
9410
9410
...
@@ -1822,8 +1822,8 @@ fld3 period
...
@@ -1822,8 +1822,8 @@ fld3 period
breaking 1001
breaking 1001
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
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 FIRST t2 const fld1 fld1 4 const 1
1 SIMPLE t2 const fld1 fld1 4 const 1
1 FIRST t3 const PRIMARY,period PRIMARY 4 const 1
1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
select fld3,period from t2,t1 where companynr*10 = 37*10;
select fld3,period from t2,t1 where companynr*10 = 37*10;
fld3 period
fld3 period
breaking 9410
breaking 9410
...
@@ -2562,20 +2562,20 @@ select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.
...
@@ -2562,20 +2562,20 @@ select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.
companynr companyname
companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr 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 FIRST t2 ALL NULL NULL NULL NULL 1199
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
1 FIRST t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr 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 FIRST t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 FIRST t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
companynr companynr
37 36
37 36
41 40
41 40
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+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 FIRST t2 ALL NULL NULL NULL NULL 1199 Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
1 FIRST t4 index NULL PRIMARY 1 NULL 12 where used; Using index
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 where used; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
fld1 companynr fld3 period
038008 37 reporters 1008
038008 37 reporters 1008
...
@@ -3085,10 +3085,10 @@ fld1 sum(price)
...
@@ -3085,10 +3085,10 @@ fld1 sum(price)
038008 234298
038008 234298
explain select fld3 from t2 where 1>2 or 2>3;
explain select fld3 from t2 where 1>2 or 2>3;
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 FIRST Impossible WHERE
1 SIMPLE Impossible WHERE
explain select fld3 from t2 where fld1=fld1;
explain select fld3 from t2 where fld1=fld1;
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 FIRST t2 ALL NULL NULL NULL NULL 1199
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
companynr fld1
companynr fld1
34 250501
34 250501
...
@@ -3140,7 +3140,7 @@ count(*)
...
@@ -3140,7 +3140,7 @@ count(*)
4181
4181
explain select min(fld1),max(fld1),count(*) from t2;
explain select min(fld1),max(fld1),count(*) from t2;
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