Commit 160f3169 authored by Igor Babaev's avatar Igor Babaev

The main patch for WL#24:

"index_merge: fair choice between index_merge union and range access"

mysql-test/include/world.inc:
  A new include file to upload the world database.
mysql-test/include/world_schema.inc:
  A new include file to create tables of the world database.
mysql-test/r/index_merge_myisam.result:
  The results for test cases testing the optimizations added in WL#24 for MyISAM.
mysql-test/r/range_vs_index_merge.result:
  The results for test cases testing the optimizations added in WL#24 for InnoDB.
mysql-test/t/range_vs_index_merge.test:
  Test cases to test the optimizations added in WL#24 for MyISAM.
mysql-test/t/range_vs_index_merge_innodb.test:
  Test cases to test the optimizations added in WL#24 for InnoDB.
sql/sql_list.h:
  Fixed a bug that did not allow adding a non-empty list to an empty list.
parent c4ff1265
This diff is collapsed.
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 ...@@ -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 ...@@ -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
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--source include/have_innodb.inc
SET SESSION STORAGE_ENGINE='InnoDB';
--source t/range_vs_index_merge.test
SET SESSION STORAGE_ENGINE=DEFAULT;
This diff is collapsed.
...@@ -168,6 +168,14 @@ class base_list :public Sql_alloc ...@@ -168,6 +168,14 @@ class base_list :public Sql_alloc
{ {
if (!list->is_empty()) if (!list->is_empty())
{ {
#if 0
#else
if (is_empty())
{
*this= *list;
return;
}
#endif
*last= list->first; *last= list->first;
last= list->last; last= list->last;
elements+= list->elements; elements+= list->elements;
......
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