mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge.
This commit is contained in:
@ -334,12 +334,12 @@ update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
|
|||||||
--replace_column 9 #
|
--replace_column 9 #
|
||||||
--replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?"
|
--replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?"
|
||||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||||
from t0 as A, t0 as B
|
from t0 as A straight_join t0 as B
|
||||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||||
|
|
||||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||||
from t0 as A, t0 as B
|
from t0 as A straight_join t0 as B
|
||||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||||
|
|
||||||
|
5343
mysql-test/include/world.inc
Executable file
5343
mysql-test/include/world.inc
Executable file
File diff suppressed because it is too large
Load Diff
25
mysql-test/include/world_schema.inc
Executable file
25
mysql-test/include/world_schema.inc
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
CREATE TABLE Country (
|
||||||
|
Code char(3) NOT NULL default '',
|
||||||
|
Name char(52) NOT NULL default '',
|
||||||
|
SurfaceArea float(10,2) NOT NULL default '0.00',
|
||||||
|
Population int(11) NOT NULL default '0',
|
||||||
|
Capital int(11) default NULL,
|
||||||
|
PRIMARY KEY (Code),
|
||||||
|
UNIQUE INDEX (Name)
|
||||||
|
);
|
||||||
|
CREATE TABLE City (
|
||||||
|
ID int(11) NOT NULL auto_increment,
|
||||||
|
Name char(35) NOT NULL default '',
|
||||||
|
Country char(3) NOT NULL default '',
|
||||||
|
Population int(11) NOT NULL default '0',
|
||||||
|
PRIMARY KEY (ID),
|
||||||
|
INDEX (Population),
|
||||||
|
INDEX (Country)
|
||||||
|
);
|
||||||
|
CREATE TABLE CountryLanguage (
|
||||||
|
Country char(3) NOT NULL default '',
|
||||||
|
Language char(30) NOT NULL default '',
|
||||||
|
Percentage float(3,1) NOT NULL default '0.0',
|
||||||
|
PRIMARY KEY (Country, Language),
|
||||||
|
INDEX (Percentage)
|
||||||
|
);
|
@ -115,11 +115,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
explain select * from t0 where
|
explain select * from t0 where
|
||||||
(key1 < 3 or key2 < 3) and (key3 < 100);
|
(key1 < 3 or key2 < 3) and (key3 < 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 t0 range i1,i2,i3 i3 4 NULL 95 Using where
|
1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
|
||||||
explain select * from t0 where
|
explain select * from t0 where
|
||||||
(key1 < 3 or key2 < 3) and (key3 < 1000);
|
(key1 < 3 or key2 < 3) and (key3 < 1000);
|
||||||
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 t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
|
1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
|
||||||
explain select * from t0 where
|
explain select * from t0 where
|
||||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||||
or
|
or
|
||||||
@ -259,7 +259,7 @@ explain
|
|||||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||||
(t0.key1=3 or t0.key2=4) and t1.key1<200;
|
(t0.key1=3 or t0.key2=4) and t1.key1<200;
|
||||||
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 t0 ALL i1,i2 NULL NULL NULL 1024 Using where
|
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||||
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
|
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
|
||||||
explain
|
explain
|
||||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||||
@ -374,14 +374,14 @@ max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.ke
|
|||||||
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
|
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
|
||||||
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
|
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
|
||||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||||
from t0 as A, t0 as B
|
from t0 as A straight_join t0 as B
|
||||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=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 A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
|
1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
|
||||||
1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where; Using join buffer
|
1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where; Using join buffer
|
||||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||||
from t0 as A, t0 as B
|
from t0 as A straight_join t0 as B
|
||||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||||
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||||
|
1462
mysql-test/r/range_vs_index_merge.result
Normal file
1462
mysql-test/r/range_vs_index_merge.result
Normal file
File diff suppressed because it is too large
Load Diff
1464
mysql-test/r/range_vs_index_merge_innodb.result
Normal file
1464
mysql-test/r/range_vs_index_merge_innodb.result
Normal file
File diff suppressed because it is too large
Load Diff
1005
mysql-test/t/range_vs_index_merge.test
Executable file
1005
mysql-test/t/range_vs_index_merge.test
Executable file
File diff suppressed because it is too large
Load Diff
7
mysql-test/t/range_vs_index_merge_innodb.test
Executable file
7
mysql-test/t/range_vs_index_merge_innodb.test
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
SET SESSION STORAGE_ENGINE='InnoDB';
|
||||||
|
|
||||||
|
--source t/range_vs_index_merge.test
|
||||||
|
|
||||||
|
SET SESSION STORAGE_ENGINE=DEFAULT;
|
1686
sql/opt_range.cc
1686
sql/opt_range.cc
File diff suppressed because it is too large
Load Diff
@ -235,6 +235,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (!list->is_empty())
|
if (!list->is_empty())
|
||||||
{
|
{
|
||||||
|
if (is_empty())
|
||||||
|
{
|
||||||
|
*this= *list;
|
||||||
|
return;
|
||||||
|
}
|
||||||
*last= list->first;
|
*last= list->first;
|
||||||
last= list->last;
|
last= list->last;
|
||||||
elements+= list->elements;
|
elements+= list->elements;
|
||||||
|
Reference in New Issue
Block a user