Commit af7d5f76 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/dlenev/src/mysql-5.0-1339
parents b0156f1f 5e81969b
...@@ -77,6 +77,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' ...@@ -77,6 +77,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
alter table t1 add unique(v); alter table t1 add unique(v);
alter table t1 add key(v); alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
--replace_column 6 #
explain select * from t1 where v='a'; explain select * from t1 where v='a';
# GROUP BY # GROUP BY
......
...@@ -1445,7 +1445,7 @@ qq ...@@ -1445,7 +1445,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 v 13 const 10 Using where 1 SIMPLE t1 ref v,v_2 # 13 const 10 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
......
...@@ -315,6 +315,7 @@ insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23'); ...@@ -315,6 +315,7 @@ insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23');
insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19'); insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19');
insert into t1 values('KKK',3,'ATL',null,null); insert into t1 values('KKK',3,'ATL',null,null);
insert into t1 values('XXX',null,'MIN',null,null); insert into t1 values('XXX',null,'MIN',null,null);
insert into t1 values('WWW',1,'LED',null,null);
insert into t2 values('TKF','Seattle','WA','AME'); insert into t2 values('TKF','Seattle','WA','AME');
insert into t2 values('LCC','Los Angeles','CA','TWU'); insert into t2 values('LCC','Los Angeles','CA','TWU');
insert into t2 values('DEN','Denver','CO','BDL'); insert into t2 values('DEN','Denver','CO','BDL');
...@@ -338,6 +339,7 @@ GTM 3 DAL 0.07 1977-09-23 ...@@ -338,6 +339,7 @@ GTM 3 DAL 0.07 1977-09-23
SSJ NULL CHI NULL 1974-03-19 SSJ NULL CHI NULL 1974-03-19
KKK 3 ATL NULL NULL KKK 3 ATL NULL NULL
XXX NULL MIN NULL NULL XXX NULL MIN NULL NULL
WWW 1 LED NULL NULL
select * from t2; select * from t2;
a1 a2 a3 a4 a1 a2 a3 a4
TKF Seattle WA AME TKF Seattle WA AME
...@@ -574,15 +576,15 @@ AME AME ...@@ -574,15 +576,15 @@ AME AME
explain explain
select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX'; select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
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 index PRIMARY PRIMARY 3 NULL 14 Using where; Using index 1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 15 Using where; Using index
explain explain
select min(a1) from t1 where a1 != 'KKK'; select min(a1) from t1 where a1 != 'KKK';
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 index PRIMARY PRIMARY 3 NULL 14 Using where; Using index 1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 15 Using where; Using index
explain explain
select max(a3) from t1 where a2 < 2 and a3 < 'SEA'; select max(a3) from t1 where a2 < 2 and a3 < 'SEA';
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 k1 k1 3 NULL 5 Using where; Using index 1 SIMPLE t1 range k1 k1 3 NULL 6 Using where; Using index
explain explain
select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA'; select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
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
...@@ -591,40 +593,40 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -591,40 +593,40 @@ id select_type table type possible_keys key key_len ref rows Extra
explain explain
select min(a4 - 0.01) from t1; select min(a4 - 0.01) from t1;
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 index NULL k2 12 NULL 14 Using index 1 SIMPLE t1 index NULL k2 12 NULL 15 Using index
explain explain
select max(a4 + 0.01) from t1; select max(a4 + 0.01) from t1;
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 index NULL k2 12 NULL 14 Using index 1 SIMPLE t1 index NULL k2 12 NULL 15 Using index
explain explain
select min(a3) from t1 where (a2 +1 ) is null; select min(a3) from t1 where (a2 +1 ) 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 index NULL k1 7 NULL 14 Using where; Using index 1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index
explain explain
select min(a3) from t1 where (a2 + 1) = 2; select min(a3) from t1 where (a2 + 1) = 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 index NULL k1 7 NULL 14 Using where; Using index 1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index
explain explain
select min(a3) from t1 where 2 = (a2 + 1); select min(a3) from t1 where 2 = (a2 + 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 index NULL k1 7 NULL 14 Using where; Using index 1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index
explain explain
select min(a2) from t1 where a2 < 2 * a2 - 8; select min(a2) from t1 where a2 < 2 * a2 - 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 index NULL k1 7 NULL 14 Using where; Using index 1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index
explain explain
select min(a1) from t1 where a1 between a3 and 'KKK'; select min(a1) from t1 where a1 between a3 and 'KKK';
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 PRIMARY NULL NULL NULL 14 Using where 1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 15 Using where
explain explain
select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08; select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
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 index NULL k2 12 NULL 14 Using where; Using index 1 SIMPLE t1 index NULL k2 12 NULL 15 Using where; Using index
explain explain
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME'; select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
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 t2 range k2 k2 4 NULL 6 Using where; Using index 1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index 1 SIMPLE t1 index NULL PRIMARY 3 NULL 15 Using index
drop table t1, t2; drop table t1, t2;
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB; create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
insert into t1 values (1, 3); insert into t1 values (1, 3);
......
...@@ -716,7 +716,7 @@ qq ...@@ -716,7 +716,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 v_2 13 const 7 Using where 1 SIMPLE t1 ref v,v_2 # 13 const 7 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
......
...@@ -216,6 +216,7 @@ insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23'); ...@@ -216,6 +216,7 @@ insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23');
insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19'); insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19');
insert into t1 values('KKK',3,'ATL',null,null); insert into t1 values('KKK',3,'ATL',null,null);
insert into t1 values('XXX',null,'MIN',null,null); insert into t1 values('XXX',null,'MIN',null,null);
insert into t1 values('WWW',1,'LED',null,null);
# Populate table t2 # Populate table t2
insert into t2 values('TKF','Seattle','WA','AME'); insert into t2 values('TKF','Seattle','WA','AME');
......
...@@ -262,11 +262,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -262,11 +262,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
} }
key_part->store_length=key_part->length; key_part->store_length=key_part->length;
} }
set_if_bigger(outparam->max_key_length,keyinfo->key_length+
keyinfo->key_parts);
outparam->total_key_length+= keyinfo->key_length;
if (keyinfo->flags & HA_NOSAME)
set_if_bigger(outparam->max_unique_length,keyinfo->key_length);
} }
keynames=(char*) key_part; keynames=(char*) key_part;
strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1;
...@@ -718,6 +713,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -718,6 +713,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
} }
} }
keyinfo->usable_key_parts=usable_parts; // Filesort keyinfo->usable_key_parts=usable_parts; // Filesort
set_if_bigger(outparam->max_key_length,keyinfo->key_length+
keyinfo->key_parts);
outparam->total_key_length+= keyinfo->key_length;
if (keyinfo->flags & HA_NOSAME)
set_if_bigger(outparam->max_unique_length,keyinfo->key_length);
} }
if (primary_key < MAX_KEY && if (primary_key < MAX_KEY &&
(outparam->keys_in_use.is_set(primary_key))) (outparam->keys_in_use.is_set(primary_key)))
......
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