Commit 80b0b300 authored by Igor Babaev's avatar Igor Babaev

Merge

parents 2721e912 1556a136
......@@ -998,6 +998,13 @@ ID Name Country Population
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
EXPLAIN
SELECT * FROM City, Country
WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND
Country.Code=City.Country;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name,CountryID,CountryName Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country #
DROP DATABASE world;
use test;
CREATE TABLE t1 (
......
......@@ -999,6 +999,13 @@ ID Name Country Population
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
EXPLAIN
SELECT * FROM City, Country
WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND
Country.Code=City.Country;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name,CountryID,CountryName Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country #
DROP DATABASE world;
use test;
CREATE TABLE t1 (
......
......@@ -396,6 +396,17 @@ SELECT * FROM City
WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%';
#
# Bug #754521: wrong cost of index intersection leading
# to the choice of a suboptimal execution plan
#
--replace_column 9 #
EXPLAIN
SELECT * FROM City, Country
WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND
Country.Code=City.Country;
DROP DATABASE world;
use test;
......
......@@ -3116,7 +3116,9 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
best_read_time)))
{
best_trp= intersect_trp;
best_read_time= best_trp->read_cost;
best_read_time= best_trp->read_cost;
set_if_smaller(param.table->quick_condition_rows,
intersect_trp->records);
}
}
......
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