3551 Evgeny Potemkin 2012-02-23 [merge]
Manual merge: mysql-trunk => mysql-next-mr-opt-backporting-wl5855.
added:
mysql-test/include/greedy_search_drop_tables.inc
mysql-test/include/greedy_search_load_tables.inc
mysql-test/include/print_greedy_search_count.inc
mysql-test/r/greedy_search.result
mysql-test/r/mysql_client_test_embedded.result
mysql-test/t/greedy_search.test
mysql-test/t/mysql_client_test_embedded.cnf
mysql-test/t/mysql_client_test_embedded.test
sql/merge_sort.h
unittest/gunit/join_tab_sort-t.cc
modified:
client/sql_string.cc
client/sql_string.h
libmysql/CMakeLists.txt
mysql-test/r/explain_json_all.result
mysql-test/r/explain_json_none.result
mysql-test/r/func_group.result
mysql-test/r/func_set.result
mysql-test/r/func_str.result
mysql-test/r/innodb_ignore_builtin.result
mysql-test/r/join_cache_bka.result
mysql-test/r/join_cache_bka_nixbnl.result
mysql-test/r/join_cache_bkaunique.result
mysql-test/r/join_cache_bnl.result
mysql-test/r/join_cache_nojb.result
mysql-test/r/join_nested.result
mysql-test/r/join_nested_bka.result
mysql-test/r/join_nested_bka_nixbnl.result
mysql-test/r/myisam.result
mysql-test/r/mysqld--help-win.result
mysql-test/r/select_found.result
mysql-test/r/subquery_all.result
mysql-test/r/subquery_all_bka.result
mysql-test/r/subquery_mat_all.result
mysql-test/r/subquery_mat_none.result
mysql-test/r/subquery_sj_dupsweed.result
mysql-test/r/subquery_sj_dupsweed_bka.result
mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
mysql-test/r/subquery_sj_dupsweed_bkaunique.result
mysql-test/r/subquery_sj_firstmatch.result
mysql-test/r/subquery_sj_firstmatch_bka.result
mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
mysql-test/r/subquery_sj_firstmatch_bkaunique.result
mysql-test/r/subquery_sj_loosescan.result
mysql-test/r/subquery_sj_loosescan_bka.result
mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
mysql-test/r/subquery_sj_loosescan_bkaunique.result
mysql-test/suite/innodb/t/innodb_bug34300.test
mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
mysql-test/suite/opt_trace/r/range_no_prot.result
mysql-test/suite/opt_trace/r/range_ps_prot.result
mysql-test/suite/opt_trace/r/subquery_no_prot.result
mysql-test/suite/opt_trace/r/subquery_ps_prot.result
mysql-test/suite/parts/t/partition_alter4_myisam.test
mysql-test/suite/rpl/t/rpl_row_event_max_size.test
mysql-test/t/disabled.def
mysql-test/t/func_group.test
mysql-test/t/func_set.test
mysql-test/t/func_str.test
mysql-test/t/innodb_ignore_builtin.test
sql/item_strfunc.cc
sql/item_strfunc.h
sql/log_event.cc
sql/mysqld.cc
sql/rpl_handler.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_executor.cc
sql/sql_list.h
sql/sql_load.cc
sql/sql_optimizer.cc
sql/sql_optimizer.h
sql/sql_planner.cc
sql/sql_planner.h
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_string.cc
sql/sql_string.h
sql/sys_vars.cc
tests/mysql_client_test.c
unittest/gunit/CMakeLists.txt
unittest/gunit/opt_range-t.cc
3550 Gleb Shchepa 2012-02-23
WL#5855, after-mrge test result update.
TODO:
1) fix: UNCACHEABLE DERIVED --> DERIVED;
2) re-check "Using filesort" and "Using temporary table" with pre-WL test results.
modified:
mysql-test/r/fulltext.result
mysql-test/r/fulltext_order_by.result
mysql-test/r/innodb_explain_non_select_all.result
mysql-test/r/innodb_explain_non_select_none.result
mysql-test/r/myisam_explain_non_select_all.result
mysql-test/r/myisam_explain_non_select_none.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/partition.result
mysql-test/r/subquery_all.result
mysql-test/r/subquery_all_bka.result
mysql-test/r/subquery_all_bka_nixbnl.result
mysql-test/r/subquery_mat.result
mysql-test/r/subquery_mat_all.result
mysql-test/r/subquery_mat_none.result
mysql-test/r/subquery_nomat_nosj.result
mysql-test/r/subquery_nomat_nosj_bka.result
mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
mysql-test/r/subquery_none.result
mysql-test/r/subquery_none_bka.result
mysql-test/r/subquery_none_bka_nixbnl.result
mysql-test/suite/innodb_fts/r/fulltext.result
mysql-test/suite/innodb_fts/r/fulltext_order_by.result
=== modified file 'client/sql_string.cc'
--- a/client/sql_string.cc 2012-02-16 09:51:14 +0000
+++ b/client/sql_string.cc 2012-02-22 08:57:27 +0000
@@ -479,7 +479,7 @@ bool String::append_with_prefill(const c
return FALSE;
}
-uint32 String::numchars()
+uint32 String::numchars() const
{
return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
}
=== modified file 'client/sql_string.h'
--- a/client/sql_string.h 2011-06-30 15:50:45 +0000
+++ b/client/sql_string.h 2012-02-22 08:57:27 +0000
@@ -269,7 +269,7 @@ public:
friend int sortcmp(const String *a,const String *b, const CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
- uint32 numchars();
+ uint32 numchars() const;
int charpos(int i,uint32 offset=0);
int reserve(uint32 space_needed)
=== modified file 'libmysql/CMakeLists.txt'
--- a/libmysql/CMakeLists.txt 2012-02-17 10:30:31 +0000
+++ b/libmysql/CMakeLists.txt 2012-02-20 13:27:26 +0000
@@ -150,6 +150,17 @@ SET(CLIENT_SOURCES
../sql/password.c
../sql/my_rnd.cc
)
+
+# We do RESTRICT_SYMBOL_EXPORTS(yassl) elsewhere.
+# In order to get correct symbol visibility, md5.cc and sha1.cc
+# must be compiled with "-fvisibility=hidden"
+IF(HAVE_VISIBILITY_HIDDEN)
+ SET_SOURCE_FILES_PROPERTIES(../sql/md5.cc
+ PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+ SET_SOURCE_FILES_PROPERTIES(../sql/sha1.cc
+ PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+ENDIF()
+
ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})
DTRACE_INSTRUMENT(clientlib)
ADD_DEPENDENCIES(clientlib GenError)
=== added file 'mysql-test/include/greedy_search_drop_tables.inc'
--- a/mysql-test/include/greedy_search_drop_tables.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/greedy_search_drop_tables.inc 2012-02-23 11:22:34 +0000
@@ -0,0 +1,3 @@
+DROP TABLE tbl10, tbl100;
+DROP TABLE t10_1,t10_2,t10_3,t10_4,t10_5,t10_6,t10_7,t10_8,t10_9;
+DROP TABLE t100_1,t100_2,t100_3,t100_4,t100_5,t100_6,t100_7,t100_8,t100_9;
=== added file 'mysql-test/include/greedy_search_load_tables.inc'
--- a/mysql-test/include/greedy_search_load_tables.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/greedy_search_load_tables.inc 2012-02-23 11:22:34 +0000
@@ -0,0 +1,35 @@
+--disable_query_log
+--disable_result_log
+
+# tbl10 and tbl100 are only used to fill the tables used during testing
+CREATE TABLE tbl10(
+ k INT NOT NULL AUTO_INCREMENT,
+ i INT,
+ PRIMARY KEY(k)
+);
+INSERT INTO tbl10(i) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(0);
+
+CREATE TABLE tbl100 LIKE tbl10;
+INSERT INTO tbl100(i) SELECT x.i FROM tbl10 AS x, tbl10 AS y;
+
+let $i= 1;
+WHILE ($i < 10)
+{
+ --let $stmt= CREATE TABLE t10_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
+ --eval $stmt;
+ --let $stmt= INSERT INTO t10_$i (colidx, col) SELECT k, k FROM tbl10
+ --eval $stmt;
+ # Update index statistics
+ ANALYZE TABLE t10_$i;
+
+ --let $stmt= CREATE TABLE t100_$i (pk int PRIMARY KEY AUTO_INCREMENT, colidx int, col int, index (colidx))
+ --eval $stmt;
+ --let $stmt= INSERT INTO t100_$i (colidx, col) SELECT a.k, a.k FROM tbl10 a JOIN tbl10 b;
+ --eval $stmt;
+ # Update index statistics
+ ANALYZE TABLE t10_$i;
+
+ inc $i;
+}
+--enable_result_log
+--enable_query_log
=== added file 'mysql-test/include/print_greedy_search_count.inc'
--- a/mysql-test/include/print_greedy_search_count.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/print_greedy_search_count.inc 2012-02-23 11:22:34 +0000
@@ -0,0 +1,25 @@
+# include/print_greedy_search_count.inc
+#
+# SUMMARY
+#
+# $query should be assigned a select statement.
+# The query will be EXPLAINed and the number of
+# partial plans greedy search went through to
+# create the QEP is printed.
+#
+# USAGE
+#
+# let $query= <query>;
+# --source include/print_greedy_search_count.inc
+#
+# EXAMPLE
+# t/greedy_search.test
+#
+
+eval EXPLAIN $query;
+
+let $greedy_search_partial_plans=
+ query_get_value(SHOW STATUS LIKE 'Opt_partial_plans', Value, 1);
+
+--echo ### Opt_partial_plans: $greedy_search_partial_plans
+FLUSH STATUS;
=== modified file 'mysql-test/r/explain_json_all.result'
--- a/mysql-test/r/explain_json_all.result 2012-02-20 17:32:29 +0000
+++ b/mysql-test/r/explain_json_all.result 2012-02-23 18:36:17 +0000
@@ -991,8 +991,8 @@ WHERE c IN (SELECT t2.c FROM t1 JOIN t2
AND c IN (SELECT t4.c FROM t3 JOIN t4 ON t4.c_key = t3.c_key);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t5 ALL NULL NULL NULL NULL 3
-1 SIMPLE t1 index c_key c_key 5 NULL 3 Using index; Start materialize
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; End materialize; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Start materialize
+1 SIMPLE t1 index c_key c_key 5 NULL 3 Using where; Using index; End materialize; Using join buffer (Block Nested Loop)
1 SIMPLE t4 ALL NULL NULL NULL NULL 3 Using where; Start materialize
1 SIMPLE t3 ref c_key c_key 5 test.t4.c_key 1 Using index; End materialize
EXPLAIN FORMAT=JSON SELECT * FROM t5
@@ -1022,6 +1022,14 @@ EXPLAIN
"nested_loop": [
{
"table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ } /* table */
+ },
+ {
+ "table": {
"table_name": "t1",
"access_type": "index",
"possible_keys": [
@@ -1031,15 +1039,7 @@ EXPLAIN
"key_length": "5",
"rows": 3,
"filtered": 100,
- "using_index": true
- } /* table */
- },
- {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
+ "using_index": true,
"using_join_buffer": "Block Nested Loop",
"attached_condition": true
} /* table */
@@ -1093,7 +1093,7 @@ EXPLAIN
} /* query_block */
}
Warnings:
-Note 1003 /* select#1 */ select `test`.`t5`.`c` AS `c` from `test`.`t5` semi join (`test`.`t1` join `test`.`t2`) semi join (`test`.`t3` join `test`.`t4`) where ((`test`.`t3`.`c_key` = `test`.`t4`.`c_key`) and (`test`.`t2`.`c_key` = `test`.`t1`.`c_key`) and (`test`.`t2`.`c` = `test`.`t5`.`c`) and (`test`.`t4`.`c` = `test`.`t5`.`c`))
+Note 1003 /* select#1 */ select `test`.`t5`.`c` AS `c` from `test`.`t5` semi join (`test`.`t1` join `test`.`t2`) semi join (`test`.`t3` join `test`.`t4`) where ((`test`.`t3`.`c_key` = `test`.`t4`.`c_key`) and (`test`.`t1`.`c_key` = `test`.`t2`.`c_key`) and (`test`.`t2`.`c` = `test`.`t5`.`c`) and (`test`.`t4`.`c` = `test`.`t5`.`c`))
DROP TABLE t1, t2, t3, t4, t5;
CREATE TABLE t1 (i INT);
CREATE TABLE t2 (i INT);
=== modified file 'mysql-test/r/explain_json_none.result'
--- a/mysql-test/r/explain_json_none.result 2012-02-20 15:57:51 +0000
+++ b/mysql-test/r/explain_json_none.result 2012-02-23 18:36:17 +0000
@@ -991,8 +991,8 @@ id select_type table type possible_keys
1 PRIMARY t5 ALL NULL NULL NULL NULL 3 Using where
3 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 3 Using where
3 DEPENDENT SUBQUERY t3 ref c_key c_key 5 test.t4.c_key 1 Using index
-2 DEPENDENT SUBQUERY t1 index c_key c_key 5 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
+2 DEPENDENT SUBQUERY t1 index c_key c_key 5 NULL 3 Using where; Using index; Using join buffer (Block Nested Loop)
EXPLAIN FORMAT=JSON SELECT * FROM t5
WHERE c IN (SELECT t2.c FROM t1 JOIN t2 ON t2.c_key = t1.c_key)
AND c IN (SELECT t4.c FROM t3 JOIN t4 ON t4.c_key = t3.c_key);
@@ -1050,6 +1050,15 @@ EXPLAIN
"nested_loop": [
{
"table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": true
+ } /* table */
+ },
+ {
+ "table": {
"table_name": "t1",
"access_type": "index",
"possible_keys": [
@@ -1059,15 +1068,7 @@ EXPLAIN
"key_length": "5",
"rows": 3,
"filtered": 100,
- "using_index": true
- } /* table */
- },
- {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
+ "using_index": true,
"using_join_buffer": "Block Nested Loop",
"attached_condition": true
} /* table */
@@ -1080,7 +1081,7 @@ EXPLAIN
} /* query_block */
}
Warnings:
-Note 1003 /* select#1 */ select `test`.`t5`.`c` AS `c` from `test`.`t5` where (<in_optimizer>(`test`.`t5`.`c`,<exists>(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c_key` = `test`.`t1`.`c_key`) and (<cache>(`test`.`t5`.`c`) = `test`.`t2`.`c`)))) and <in_optimizer>(`test`.`t5`.`c`,<exists>(/* select#3 */ select 1 from `test`.`t3` join `test`.`t4` where ((`test`.`t3`.`c_key` = `test`.`t4`.`c_key`) and (<cache>(`test`.`t5`.`c`) = `test`.`t4`.`c`)))))
+Note 1003 /* select#1 */ select `test`.`t5`.`c` AS `c` from `test`.`t5` where (<in_optimizer>(`test`.`t5`.`c`,<exists>(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`c_key` = `test`.`t2`.`c_key`) and (<cache>(`test`.`t5`.`c`) = `test`.`t2`.`c`)))) and <in_optimizer>(`test`.`t5`.`c`,<exists>(/* select#3 */ select 1 from `test`.`t3` join `test`.`t4` where ((`test`.`t3`.`c_key` = `test`.`t4`.`c_key`) and (<cache>(`test`.`t5`.`c`) = `test`.`t4`.`c`)))))
DROP TABLE t1, t2, t3, t4, t5;
CREATE TABLE t1 (i INT);
CREATE TABLE t2 (i INT);
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result 2011-12-22 13:36:08 +0000
+++ b/mysql-test/r/func_group.result 2012-02-22 09:26:19 +0000
@@ -1813,3 +1813,19 @@ SELECT MAX(a) FROM t1 WHERE a NOT BETWEE
MAX(a)
10
DROP TABLE t1;
+#
+# Bug#13724099 1032 BYTE MEMORY LEAK NEW_CACHED_ITEM IN
+# SUBQUERY WITH GROUPING OF OUTER COLUMN
+#
+CREATE TABLE t1 (
+a BLOB,
+b INT)
+engine=innodb;
+INSERT INTO t1 VALUES ('a', 0);
+SELECT 0 FROM t1
+WHERE 0 = (SELECT group_concat(b)
+FROM t1 t GROUP BY t1.a)
+;
+0
+0
+DROP TABLE t1;
=== modified file 'mysql-test/r/func_set.result'
--- a/mysql-test/r/func_set.result 2012-01-10 08:24:24 +0000
+++ b/mysql-test/r/func_set.result 2012-02-22 08:57:27 +0000
@@ -211,3 +211,37 @@ COUNT(*)
2
DROP TABLE t1;
# End of test BUG#12211480
+#
+# Bug#12677197 MAKE_SET() AND MY_EMPTY_STRING BUGS CAUSE CRASHING
+#
+do
+nullif( ( rtrim( make_set((cast(('%S') as unsigned)),
+(point((0xaf),(''))))
+)
+), (''))
+;
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '%S'
+do
+dayofmonth( ( not( trim( trailing( convert((''), binary(4)))
+from( make_set( ('>>'), ('`'))))
+)))
+;
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '>>'
+Warning 1292 Incorrect datetime value: '1'
+do quote(make_set((''), (cast(('-2147483649.1') as binary(513)))));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+do
+trim( both(-8388607)
+from( make_set( ( extract( minute_second from
+( str_to_date((rpad(1.0,4,1)), ('')))
+)
+),
+( char((connection_id()) using macce)))
+)
+)
+;
+Warnings:
+Warning 1292 Truncated incorrect date value: '1.01'
=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result 2012-01-25 15:49:57 +0000
+++ b/mysql-test/r/func_str.result 2012-02-23 10:08:33 +0000
@@ -119,7 +119,7 @@ substring_index('aaaaaaaaa1','aaa',-3)
aaaaaa1
select substring_index('aaaaaaaaa1','aaa',-4);
substring_index('aaaaaaaaa1','aaa',-4)
-
+aaaaaaaaa1
select substring_index('the king of thethe hill','the',-2);
substring_index('the king of thethe hill','the',-2)
the hill
@@ -4464,5 +4464,28 @@ EXECUTE stmt;
COLLATION(space(2))
latin2_general_ci
#
+# Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED
+# INSIDE LOWER()
+#
+SET @user_at_host = 'root@stripped';
+SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));
+LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1))
+mytinyhost-pc.local
+# End of test BUG#11829861
+#
+# Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT
+#
+CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL);
+INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom');
+SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1;
+i SUBSTRING_INDEX(c, '.', -2)
+1 .wwwmysqlcom
+SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t;
+i SUBSTRING_INDEX(c, '.', -2)
+0 mysql.com
+1 .wwwmysqlcom
+DROP TABLE t;
+# End of test BUG#42404
+#
# End of 5.6 tests
#
=== added file 'mysql-test/r/greedy_search.result'
--- a/mysql-test/r/greedy_search.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/greedy_search.result 2012-02-23 11:22:34 +0000
@@ -0,0 +1,194 @@
+#
+# TEST 1
+# Greedy search iteration test for 16-way join: star schema
+#
+# Creation of 16 tables hidden
+#
+SET SESSION optimizer_search_depth = 25;
+FLUSH STATUS;
+#
+# 16-way join - all 15 fact tables joined on column with key
+#
+EXPLAIN SELECT *
+FROM vehicles
+JOIN models ON vehicles.model_id = models.id_pk
+JOIN subtypes ON vehicles.subtype_id = subtypes.id_pk
+JOIN colors ON vehicles.color_id = colors.id_pk
+JOIN heating ON vehicles.heating_id = heating.id_pk
+JOIN windows ON vehicles.window_id = windows.id_pk
+JOIN fuels ON vehicles.fuel_id = fuels.id_pk
+JOIN transmissions ON vehicles.transmission_id = transmissions.id_pk
+JOIN steerings ON vehicles.steering_id = steerings.id_pk
+JOIN interiors ON vehicles.interior_id = interiors.id_pk
+JOIN drives ON vehicles.drive_id = drives.id_pk
+JOIN wheels ON vehicles.wheels_id = wheels.id_pk
+JOIN engine ON vehicles.engine_id = engine.id_pk
+JOIN price_ranges ON vehicles.price_range_id = price_ranges.id_pk
+JOIN countries ON vehicles.assembled_in = countries.id_pk
+JOIN brands ON models.brand_id = brands.id_pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE vehicles ALL NULL NULL NULL NULL 80 Using where
+1 SIMPLE subtypes eq_ref PRIMARY PRIMARY 4 test.vehicles.subtype_id 1
+1 SIMPLE heating eq_ref PRIMARY PRIMARY 4 test.vehicles.heating_id 1
+1 SIMPLE windows eq_ref PRIMARY PRIMARY 4 test.vehicles.window_id 1
+1 SIMPLE fuels eq_ref PRIMARY PRIMARY 4 test.vehicles.fuel_id 1
+1 SIMPLE transmissions eq_ref PRIMARY PRIMARY 4 test.vehicles.transmission_id 1
+1 SIMPLE steerings eq_ref PRIMARY PRIMARY 4 test.vehicles.steering_id 1
+1 SIMPLE drives eq_ref PRIMARY PRIMARY 4 test.vehicles.drive_id 1
+1 SIMPLE wheels eq_ref PRIMARY PRIMARY 4 test.vehicles.wheels_id 1
+1 SIMPLE engine eq_ref PRIMARY PRIMARY 4 test.vehicles.engine_id 1
+1 SIMPLE price_ranges eq_ref PRIMARY PRIMARY 4 test.vehicles.price_range_id 1
+1 SIMPLE colors eq_ref PRIMARY PRIMARY 4 test.vehicles.color_id 1
+1 SIMPLE interiors eq_ref PRIMARY PRIMARY 4 test.vehicles.interior_id 1
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 test.vehicles.assembled_in 1
+1 SIMPLE models eq_ref PRIMARY,brand_id PRIMARY 4 test.vehicles.model_id 1 Using where
+1 SIMPLE brands eq_ref PRIMARY PRIMARY 4 test.models.brand_id 1
+### Opt_partial_plans: 50922
+FLUSH STATUS;
+#
+# 16-way join - 10 fact tables joined on column with key and
+# 5 fact tables joined on column without key
+#
+EXPLAIN SELECT *
+FROM vehicles
+JOIN models ON vehicles.model_id = models.id_nokey
+JOIN subtypes ON vehicles.subtype_id = subtypes.id_pk
+JOIN colors ON vehicles.color_id = colors.id_pk
+JOIN heating ON vehicles.heating_id = heating.id_nokey
+JOIN windows ON vehicles.window_id = windows.id_pk
+JOIN fuels ON vehicles.fuel_id = fuels.id_pk
+JOIN transmissions ON vehicles.transmission_id = transmissions.id_nokey
+JOIN steerings ON vehicles.steering_id = steerings.id_pk
+JOIN interiors ON vehicles.interior_id = interiors.id_pk
+JOIN drives ON vehicles.drive_id = drives.id_pk
+JOIN wheels ON vehicles.wheels_id = wheels.id_nokey
+JOIN engine ON vehicles.engine_id = engine.id_pk
+JOIN price_ranges ON vehicles.price_range_id = price_ranges.id_pk
+JOIN countries ON vehicles.assembled_in = countries.id_pk
+JOIN brands ON models.brand_id = brands.id_nokey;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE brands ALL NULL NULL NULL NULL 7 Using where
+1 SIMPLE models ref brand_id brand_id 5 test.brands.id_nokey 4
+1 SIMPLE heating ALL NULL NULL NULL NULL 10 Using join buffer (Block Nested Loop)
+1 SIMPLE transmissions ALL NULL NULL NULL NULL 10 Using join buffer (Block Nested Loop)
+1 SIMPLE wheels ALL NULL NULL NULL NULL 10 Using join buffer (Block Nested Loop)
+1 SIMPLE vehicles ALL NULL NULL NULL NULL 80 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE windows eq_ref PRIMARY PRIMARY 4 test.vehicles.window_id 1
+1 SIMPLE fuels eq_ref PRIMARY PRIMARY 4 test.vehicles.fuel_id 1
+1 SIMPLE steerings eq_ref PRIMARY PRIMARY 4 test.vehicles.steering_id 1
+1 SIMPLE drives eq_ref PRIMARY PRIMARY 4 test.vehicles.drive_id 1
+1 SIMPLE engine eq_ref PRIMARY PRIMARY 4 test.vehicles.engine_id 1
+1 SIMPLE price_ranges eq_ref PRIMARY PRIMARY 4 test.vehicles.price_range_id 1
+1 SIMPLE interiors eq_ref PRIMARY PRIMARY 4 test.vehicles.interior_id 1
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 test.vehicles.assembled_in 1
+1 SIMPLE subtypes eq_ref PRIMARY PRIMARY 4 test.vehicles.subtype_id 1
+1 SIMPLE colors eq_ref PRIMARY PRIMARY 4 test.vehicles.color_id 1
+### Opt_partial_plans: 483932
+FLUSH STATUS;
+select @@optimizer_search_depth;
+@@optimizer_search_depth
+25
+select @@optimizer_prune_level;
+@@optimizer_prune_level
+1
+DROP TABLE vehicles, models, subtypes, colors, heating, windows,
+fuels, transmissions, steerings, interiors, drives,
+price_ranges, countries, brands, wheels, engine;
+#
+# TEST 2
+# Greedy search iteration test for chain of tables
+#
+#
+# Chain test a: colidx):(pk,colidx):(pk,colidx)
+#
+EXPLAIN SELECT * FROM t10_1 JOIN t100_1 ON t10_1.colidx = t100_1.pk JOIN t10_2 ON t100_1.colidx = t10_2.pk JOIN t100_2 ON t10_2.colidx = t100_2.pk JOIN t10_3 ON t100_2.colidx = t10_3.pk JOIN t100_3 ON t10_3.colidx = t100_3.pk JOIN t10_4 ON t100_3.colidx = t10_4.pk JOIN t100_4 ON t10_4.colidx = t100_4.pk JOIN t10_5 ON t100_4.colidx = t10_5.pk JOIN t100_5 ON t10_5.colidx = t100_5.pk JOIN t10_6 ON t100_5.colidx = t10_6.pk JOIN t100_6 ON t10_6.colidx = t100_6.pk JOIN t10_7 ON t100_6.colidx = t10_7.pk JOIN t100_7 ON t10_7.colidx = t100_7.pk JOIN t10_8 ON t100_7.colidx = t10_8.pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10_1 ALL colidx NULL NULL NULL 10 Using where
+1 SIMPLE t100_1 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_1.colidx 1 Using where
+1 SIMPLE t10_2 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_1.colidx 1 Using where
+1 SIMPLE t100_2 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_2.colidx 1 Using where
+1 SIMPLE t10_3 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_2.colidx 1 Using where
+1 SIMPLE t100_3 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_3.colidx 1 Using where
+1 SIMPLE t10_4 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_3.colidx 1 Using where
+1 SIMPLE t100_4 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_4.colidx 1 Using where
+1 SIMPLE t10_5 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_4.colidx 1 Using where
+1 SIMPLE t100_5 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_5.colidx 1 Using where
+1 SIMPLE t10_6 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_5.colidx 1 Using where
+1 SIMPLE t100_6 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_6.colidx 1 Using where
+1 SIMPLE t10_7 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_6.colidx 1 Using where
+1 SIMPLE t100_7 eq_ref PRIMARY,colidx PRIMARY 4 test.t10_7.colidx 1 Using where
+1 SIMPLE t10_8 eq_ref PRIMARY PRIMARY 4 test.t100_7.colidx 1
+### Opt_partial_plans: 3669
+FLUSH STATUS;
+#
+# Chain test b: (...,col):(colidx, col):(pk,col):(colidx,col):(pk,...)
+#
+EXPLAIN SELECT * FROM t10_1 JOIN t100_1 ON t10_1.col = t100_1.colidx JOIN t10_2 ON t100_1.col = t10_2.pk JOIN t100_2 ON t10_2.col = t100_2.colidx JOIN t10_3 ON t100_2.col = t10_3.pk JOIN t100_3 ON t10_3.col = t100_3.colidx JOIN t10_4 ON t100_3.col = t10_4.pk JOIN t100_4 ON t10_4.col = t100_4.colidx JOIN t10_5 ON t100_4.col = t10_5.pk JOIN t100_5 ON t10_5.col = t100_5.colidx JOIN t10_6 ON t100_5.col = t10_6.pk JOIN t100_6 ON t10_6.col = t100_6.colidx JOIN t10_7 ON t100_6.col = t10_7.pk JOIN t100_7 ON t10_7.col = t100_7.colidx JOIN t10_8 ON t100_7.col = t10_8.pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10_1 ALL NULL NULL NULL NULL 10 Using where
+1 SIMPLE t100_1 ref colidx colidx 5 test.t10_1.col 10 Using where
+1 SIMPLE t10_2 eq_ref PRIMARY PRIMARY 4 test.t100_1.col 1 Using where
+1 SIMPLE t100_2 ref colidx colidx 5 test.t10_2.col 10 Using where
+1 SIMPLE t10_3 eq_ref PRIMARY PRIMARY 4 test.t100_2.col 1 Using where
+1 SIMPLE t100_3 ref colidx colidx 5 test.t10_3.col 10 Using where
+1 SIMPLE t10_4 eq_ref PRIMARY PRIMARY 4 test.t100_3.col 1 Using where
+1 SIMPLE t100_4 ref colidx colidx 5 test.t10_4.col 10 Using where
+1 SIMPLE t10_5 eq_ref PRIMARY PRIMARY 4 test.t100_4.col 1 Using where
+1 SIMPLE t100_5 ref colidx colidx 5 test.t10_5.col 10 Using where
+1 SIMPLE t10_6 eq_ref PRIMARY PRIMARY 4 test.t100_5.col 1 Using where
+1 SIMPLE t100_6 ref colidx colidx 5 test.t10_6.col 10 Using where
+1 SIMPLE t10_7 eq_ref PRIMARY PRIMARY 4 test.t100_6.col 1 Using where
+1 SIMPLE t100_7 ref colidx colidx 5 test.t10_7.col 10 Using where
+1 SIMPLE t10_8 eq_ref PRIMARY PRIMARY 4 test.t100_7.col 1
+### Opt_partial_plans: 692133
+FLUSH STATUS;
+#
+# Chain test c: (...,colidx):(col, pk):(col,colidx):(col,...)
+#
+EXPLAIN SELECT * FROM t10_1 JOIN t100_1 ON t10_1.colidx = t100_1.col JOIN t10_2 ON t100_1.pk = t10_2.col JOIN t100_2 ON t10_2.colidx = t100_2.col JOIN t10_3 ON t100_2.pk = t10_3.col JOIN t100_3 ON t10_3.colidx = t100_3.col JOIN t10_4 ON t100_3.pk = t10_4.col JOIN t100_4 ON t10_4.colidx = t100_4.col JOIN t10_5 ON t100_4.pk = t10_5.col JOIN t100_5 ON t10_5.colidx = t100_5.col JOIN t10_6 ON t100_5.pk = t10_6.col JOIN t100_6 ON t10_6.colidx = t100_6.col JOIN t10_7 ON t100_6.pk = t10_7.col JOIN t100_7 ON t10_7.colidx = t100_7.col JOIN t10_8 ON t100_7.pk = t10_8.col;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10_8 ALL NULL NULL NULL NULL 10 Using where
+1 SIMPLE t100_7 eq_ref PRIMARY PRIMARY 4 test.t10_8.col 1 Using where
+1 SIMPLE t10_7 ref colidx colidx 5 test.t100_7.col 1 Using where
+1 SIMPLE t100_6 eq_ref PRIMARY PRIMARY 4 test.t10_7.col 1 Using where
+1 SIMPLE t10_6 ref colidx colidx 5 test.t100_6.col 1 Using where
+1 SIMPLE t100_5 eq_ref PRIMARY PRIMARY 4 test.t10_6.col 1 Using where
+1 SIMPLE t10_5 ref colidx colidx 5 test.t100_5.col 1 Using where
+1 SIMPLE t100_4 eq_ref PRIMARY PRIMARY 4 test.t10_5.col 1 Using where
+1 SIMPLE t10_4 ref colidx colidx 5 test.t100_4.col 1 Using where
+1 SIMPLE t100_3 eq_ref PRIMARY PRIMARY 4 test.t10_4.col 1 Using where
+1 SIMPLE t10_3 ref colidx colidx 5 test.t100_3.col 1 Using where
+1 SIMPLE t100_2 eq_ref PRIMARY PRIMARY 4 test.t10_3.col 1 Using where
+1 SIMPLE t10_2 ref colidx colidx 5 test.t100_2.col 1 Using where
+1 SIMPLE t100_1 eq_ref PRIMARY PRIMARY 4 test.t10_2.col 1 Using where
+1 SIMPLE t10_1 ref colidx colidx 5 test.t100_1.col 1
+### Opt_partial_plans: 12025
+FLUSH STATUS;
+#
+# Chain test d: (...,colidx):(pk, col):(pk,colidx):(pk,col):(pk,...)
+#
+EXPLAIN SELECT * FROM t10_1 JOIN t100_1 ON t10_1.colidx = t100_1.pk JOIN t10_2 ON t100_1.col = t10_2.pk JOIN t100_2 ON t10_2.colidx = t100_2.pk JOIN t10_3 ON t100_2.col = t10_3.pk JOIN t100_3 ON t10_3.colidx = t100_3.pk JOIN t10_4 ON t100_3.col = t10_4.pk JOIN t100_4 ON t10_4.colidx = t100_4.pk JOIN t10_5 ON t100_4.col = t10_5.pk JOIN t100_5 ON t10_5.colidx = t100_5.pk JOIN t10_6 ON t100_5.col = t10_6.pk JOIN t100_6 ON t10_6.colidx = t100_6.pk JOIN t10_7 ON t100_6.col = t10_7.pk JOIN t100_7 ON t10_7.colidx = t100_7.pk JOIN t10_8 ON t100_7.col = t10_8.pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10_1 ALL colidx NULL NULL NULL 10 Using where
+1 SIMPLE t100_1 eq_ref PRIMARY PRIMARY 4 test.t10_1.colidx 1 Using where
+1 SIMPLE t10_2 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_1.col 1 Using where
+1 SIMPLE t100_2 eq_ref PRIMARY PRIMARY 4 test.t10_2.colidx 1 Using where
+1 SIMPLE t10_3 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_2.col 1 Using where
+1 SIMPLE t100_3 eq_ref PRIMARY PRIMARY 4 test.t10_3.colidx 1 Using where
+1 SIMPLE t10_4 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_3.col 1 Using where
+1 SIMPLE t100_4 eq_ref PRIMARY PRIMARY 4 test.t10_4.colidx 1 Using where
+1 SIMPLE t10_5 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_4.col 1 Using where
+1 SIMPLE t100_5 eq_ref PRIMARY PRIMARY 4 test.t10_5.colidx 1 Using where
+1 SIMPLE t10_6 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_5.col 1 Using where
+1 SIMPLE t100_6 eq_ref PRIMARY PRIMARY 4 test.t10_6.colidx 1 Using where
+1 SIMPLE t10_7 eq_ref PRIMARY,colidx PRIMARY 4 test.t100_6.col 1 Using where
+1 SIMPLE t100_7 eq_ref PRIMARY PRIMARY 4 test.t10_7.colidx 1 Using where
+1 SIMPLE t10_8 eq_ref PRIMARY PRIMARY 4 test.t100_7.col 1
+### Opt_partial_plans: 1445
+FLUSH STATUS;
+#
+# Cleanup after TEST 2
+#
+DROP TABLE tbl10, tbl100;
+DROP TABLE t10_1,t10_2,t10_3,t10_4,t10_5,t10_6,t10_7,t10_8,t10_9;
+DROP TABLE t100_1,t100_2,t100_3,t100_4,t100_5,t100_6,t100_7,t100_8,t100_9;
=== modified file 'mysql-test/r/innodb_ignore_builtin.result'
--- a/mysql-test/r/innodb_ignore_builtin.result 2009-02-09 15:03:52 +0000
+++ b/mysql-test/r/innodb_ignore_builtin.result 2012-02-20 11:54:49 +0000
@@ -1,9 +1,12 @@
+call mtr.add_suppression("is ignored and will be removed in future releases");
show variables like 'ignore_builtin_innodb';
Variable_name Value
ignore_builtin_innodb ON
select PLUGIN_NAME from information_schema.plugins
where PLUGIN_NAME = "InnoDb";
PLUGIN_NAME
+InnoDB
select ENGINE from information_schema.engines
where ENGINE = "InnoDB";
ENGINE
+InnoDB
=== modified file 'mysql-test/r/join_cache_bka.result'
--- a/mysql-test/r/join_cache_bka.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/join_cache_bka.result 2012-02-23 18:36:17 +0000
@@ -2233,7 +2233,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1 force index (col_int_key), t2 ignore index (col_int_key)
@@ -2387,33 +2387,33 @@ WHERE t3.c1 = SOME (SELECT t1.c2_key FRO
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 = ANY (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 NOT IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 1 Using index; Start temporary
-1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Start temporary
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
1 SIMPLE t3 ref k1 k1 5 test.t1.c2_key 1 Using index; End temporary
SELECT t3.c1 FROM t3
WHERE t3.c1 = SOME (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
=== modified file 'mysql-test/r/join_cache_bka_nixbnl.result'
--- a/mysql-test/r/join_cache_bka_nixbnl.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/join_cache_bka_nixbnl.result 2012-02-23 18:36:17 +0000
@@ -2233,7 +2233,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1 force index (col_int_key), t2 ignore index (col_int_key)
@@ -2387,33 +2387,33 @@ WHERE t3.c1 = SOME (SELECT t1.c2_key FRO
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 = ANY (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 NOT IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 1 Using index; Start temporary
-1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Using where
+1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Start temporary
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
1 SIMPLE t3 ref k1 k1 5 test.t1.c2_key 1 Using index; End temporary
SELECT t3.c1 FROM t3
WHERE t3.c1 = SOME (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
=== modified file 'mysql-test/r/join_cache_bkaunique.result'
--- a/mysql-test/r/join_cache_bkaunique.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/join_cache_bkaunique.result 2012-02-23 18:36:17 +0000
@@ -2234,7 +2234,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1 force index (col_int_key), t2 ignore index (col_int_key)
@@ -2388,33 +2388,33 @@ WHERE t3.c1 = SOME (SELECT t1.c2_key FRO
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 = ANY (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 NOT IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 1 Using index; Start temporary
-1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Start temporary
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
1 SIMPLE t3 ref k1 k1 5 test.t1.c2_key 1 Using index; End temporary
SELECT t3.c1 FROM t3
WHERE t3.c1 = SOME (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
=== modified file 'mysql-test/r/join_cache_bnl.result'
--- a/mysql-test/r/join_cache_bnl.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/join_cache_bnl.result 2012-02-23 18:36:17 +0000
@@ -2216,7 +2216,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ref col_int_key col_int_key 5 const 1 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1,t2
@@ -2234,7 +2234,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1 force index (col_int_key), t2 ignore index (col_int_key)
@@ -2388,33 +2388,33 @@ WHERE t3.c1 = SOME (SELECT t1.c2_key FRO
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 = ANY (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 NOT IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 1 Using index; Start temporary
-1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Start temporary
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
1 SIMPLE t3 ref k1 k1 5 test.t1.c2_key 1 Using index; End temporary
SELECT t3.c1 FROM t3
WHERE t3.c1 = SOME (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
=== modified file 'mysql-test/r/join_cache_nojb.result'
--- a/mysql-test/r/join_cache_nojb.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/join_cache_nojb.result 2012-02-23 18:36:17 +0000
@@ -2216,7 +2216,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ref col_int_key col_int_key 5 const 1 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1,t2
@@ -2234,7 +2234,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1 force index (col_int_key), t2 ignore index (col_int_key)
@@ -2388,33 +2388,33 @@ WHERE t3.c1 = SOME (SELECT t1.c2_key FRO
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 = ANY (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
XOR TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 NOT IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 index NULL k1 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using index
2 DEPENDENT SUBQUERY t1 ref col_int_key col_int_key 4 func 1 Using where; Full scan on NULL key
+2 DEPENDENT SUBQUERY t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
explain SELECT t3.c1 FROM t3
WHERE t3.c1 IN (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 1 Using index; Start temporary
-1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Using where
+1 SIMPLE t1 ALL col_int_key NULL NULL NULL 1 Start temporary
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Range checked for each record (index map: 0x1)
1 SIMPLE t3 ref k1 k1 5 test.t1.c2_key 1 Using index; End temporary
SELECT t3.c1 FROM t3
WHERE t3.c1 = SOME (SELECT t1.c2_key FROM t2 JOIN t1 ON t2.pk < t1.c1)
=== modified file 'mysql-test/r/join_nested.result'
--- a/mysql-test/r/join_nested.result 2012-01-20 15:30:14 +0000
+++ b/mysql-test/r/join_nested.result 2012-02-23 11:22:34 +0000
@@ -546,8 +546,8 @@ id select_type table type possible_keys
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (Block Nested Loop)
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
=== modified file 'mysql-test/r/join_nested_bka.result'
--- a/mysql-test/r/join_nested_bka.result 2012-01-20 15:30:14 +0000
+++ b/mysql-test/r/join_nested_bka.result 2012-02-23 11:22:34 +0000
@@ -547,8 +547,8 @@ id select_type table type possible_keys
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (Block Nested Loop)
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
=== modified file 'mysql-test/r/join_nested_bka_nixbnl.result'
--- a/mysql-test/r/join_nested_bka_nixbnl.result 2012-01-20 15:30:14 +0000
+++ b/mysql-test/r/join_nested_bka_nixbnl.result 2012-02-23 11:22:34 +0000
@@ -547,8 +547,8 @@ id select_type table type possible_keys
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/myisam.result 2012-02-23 18:36:17 +0000
@@ -496,7 +496,7 @@ a
1
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
-Sort_scan 1
+Sort_scan 0
select sql_big_result distinct t1.a from t1,t2;
a
1
@@ -506,7 +506,7 @@ id select_type table type possible_keys
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
explain select distinct t1.a from t1,t2 order by t2.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
drop table t1,t2;
create table t1 (
=== added file 'mysql-test/r/mysql_client_test_embedded.result'
--- a/mysql-test/r/mysql_client_test_embedded.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysql_client_test_embedded.result 2012-02-23 10:39:15 +0000
@@ -0,0 +1,2 @@
+# Run the start/stop test 17 times (* 64 = 1088 restarts)
+# --silent to avoid printing out server version etc.
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2012-02-23 18:36:17 +0000
@@ -200,6 +200,7 @@ The following options may be given as th
GROUP_CONCAT()
-?, --help Display this help and exit.
--ignore-builtin-innodb
+ IGNORED. This option will be removed in future releases.
Disable initialization of builtin InnoDB plugin
--ignore-db-dir=name
Specifies a directory to add to the ignore list when
=== modified file 'mysql-test/r/select_found.result'
--- a/mysql-test/r/select_found.result 2012-02-13 08:02:08 +0000
+++ b/mysql-test/r/select_found.result 2012-02-23 18:36:17 +0000
@@ -84,24 +84,24 @@ UNIQUE KEY e_n (email,name)
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system kid NULL NULL NULL 0 const row not found
-1 SIMPLE t2 index NULL e_n 104 NULL 10 Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 Using temporary
FLUSH STATUS;
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
-Sort_scan 1
+Sort_scan 0
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
email1
+email2
+email3
+email4
+email5
+email6
+email7
+email8
+email9
email10
-email100
-email101
-email102
-email103
-email104
-email105
-email106
-email107
SELECT FOUND_ROWS();
FOUND_ROWS()
200
=== modified file 'mysql-test/r/subquery_all.result'
--- a/mysql-test/r/subquery_all.result 2012-02-23 13:09:10 +0000
+++ b/mysql-test/r/subquery_all.result 2012-02-23 18:36:17 +0000
@@ -904,10 +904,10 @@ a t1.a in (select t2.a from t2,t3 where
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using index
-2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00
+2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer (Block Nested Loop)
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t3`.`a` = `test`.`t2`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`a`))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t2`.`a` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`a`))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
=== modified file 'mysql-test/r/subquery_all_bka.result'
--- a/mysql-test/r/subquery_all_bka.result 2012-02-23 13:09:10 +0000
+++ b/mysql-test/r/subquery_all_bka.result 2012-02-23 18:36:17 +0000
@@ -905,10 +905,10 @@ a t1.a in (select t2.a from t2,t3 where
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using index
-2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop)
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00
+2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer (Block Nested Loop)
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t3`.`a` = `test`.`t2`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`a`))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t2`.`a` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`a`))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
=== modified file 'mysql-test/r/subquery_mat_all.result'
--- a/mysql-test/r/subquery_mat_all.result 2012-02-23 13:09:10 +0000
+++ b/mysql-test/r/subquery_mat_all.result 2012-02-23 18:36:17 +0000
@@ -630,10 +630,10 @@ insert into t2 values (1,10);
explain extended
select a from t1 where a in (select c from t2 where d >= 20);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index it1a it1a 4 NULL 7 100.00 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 7 100.00 Using where; Materialize
+1 SIMPLE t2 ALL NULL NULL NULL NULL 7 100.00 Using where; Materialize; Scan
+1 SIMPLE t1 ref it1a it1a 4 test.t2.c 2 100.00 Using index
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`d` >= 20))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`d` >= 20))
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -682,12 +682,12 @@ explain extended
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 index it1a,iab iab 8 NULL 7 100.00 Using index
-1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 Using where; FirstMatch(t1); Using join buffer (Block Nested Loop)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 Start temporary
+1 PRIMARY t1 ref it1a,iab iab 4 test.t2.c 1 100.00 Using where; Using index; End temporary
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
=== modified file 'mysql-test/r/subquery_mat_none.result'
--- a/mysql-test/r/subquery_mat_none.result 2012-02-23 13:09:10 +0000
+++ b/mysql-test/r/subquery_mat_none.result 2012-02-23 18:36:17 +0000
@@ -137,7 +137,7 @@ explain extended
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 3 100.00 Using index
+2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 5 60.00 Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` having (((<cache>(`test`.`t1`.`a1`) = `test`.`t2i`.`b1`) or isnull(`test`.`t2i`.`b1`)) and ((<cache>(`test`.`t1`.`a2`) = max(`test`.`t2i`.`b2`)) or isnull(max(`test`.`t2i`.`b2`))) and <is_not_null_test>(`test`.`t2i`.`b1`) and <is_not_null_test>(max(`test`.`t2i`.`b2`)))))
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
@@ -148,11 +148,11 @@ prepare st1 from "explain select * from
execute st1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 5 Using index
execute st1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2i index NULL it2i3 18 NULL 5 Using index
prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1)";
execute st2;
a1 a2
@@ -763,11 +763,11 @@ CCC 7
AAA 8
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
-Sort_scan 0
+Sort_scan 9
EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
-2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
@@ -1280,7 +1280,7 @@ HAVING COUNT(*) > 0
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY table1 system NULL NULL NULL NULL 1
1 PRIMARY table2 system PRIMARY NULL NULL NULL 1
-2 DEPENDENT SUBQUERY innr index NULL col_int_key 5 NULL 2 Using where
+2 DEPENDENT SUBQUERY innr ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
FLUSH STATUS;
SELECT table1.pk, table2.pk
FROM t2 AS table1 LEFT JOIN t2 AS table2
@@ -1296,7 +1296,7 @@ pk pk
1 NULL
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
-Sort_scan 0
+Sort_scan 1
DROP TABLE t1, t2;
# End of test for bug#13607423.
=== modified file 'mysql-test/r/subquery_sj_dupsweed.result'
--- a/mysql-test/r/subquery_sj_dupsweed.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed.result 2012-02-23 18:36:17 +0000
@@ -5172,9 +5172,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5186,14 +5186,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6763,8 +6763,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7665,8 +7665,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka.result 2012-02-23 18:36:17 +0000
@@ -5173,9 +5173,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5187,14 +5187,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6764,8 +6764,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7666,8 +7666,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result 2012-02-23 18:36:17 +0000
@@ -5180,9 +5180,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5194,14 +5194,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6771,8 +6771,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/r/subquery_sj_dupsweed_bkaunique.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bkaunique.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bkaunique.result 2012-02-23 18:36:17 +0000
@@ -5174,9 +5174,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5188,14 +5188,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6765,8 +6765,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7667,8 +7667,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_firstmatch.result'
--- a/mysql-test/r/subquery_sj_firstmatch.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch.result 2012-02-23 18:36:17 +0000
@@ -5171,9 +5171,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5185,14 +5185,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6762,8 +6762,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7664,8 +7664,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka.result 2012-02-23 18:36:17 +0000
@@ -5172,9 +5172,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5186,14 +5186,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6763,8 +6763,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7665,8 +7665,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result 2012-02-23 18:36:17 +0000
@@ -5181,9 +5181,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; FirstMatch(t1)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5195,14 +5195,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; FirstMatch(t1)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; FirstMatch(t1)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6772,8 +6772,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/r/subquery_sj_firstmatch_bkaunique.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bkaunique.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bkaunique.result 2012-02-23 18:36:17 +0000
@@ -5173,9 +5173,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5187,14 +5187,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6764,8 +6764,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
@@ -7666,8 +7666,8 @@ id select_type table type possible_keys
1 PRIMARY GP2 system NULL NULL NULL NULL 1
1 PRIMARY GP1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 index col_varchar_key col_varchar_key 4 NULL 1 Using index; Start temporary
-2 DEPENDENT SUBQUERY t3 ref col_varchar_key col_varchar_key 4 test.t2.col_varchar_key 2 Using index
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (Block Nested Loop)
+2 DEPENDENT SUBQUERY t3 index col_varchar_key col_varchar_key 4 NULL 1 Using where; Using index; End temporary; Using join buffer (Block Nested Loop)
SELECT GP1.id
FROM t1 AS GP1 JOIN t3 AS GP2
ON GP2.col_varchar_key <> GP1.col_varchar_nokey
=== modified file 'mysql-test/r/subquery_sj_loosescan.result'
--- a/mysql-test/r/subquery_sj_loosescan.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_loosescan.result 2012-02-23 18:36:17 +0000
@@ -5173,9 +5173,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5187,14 +5187,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6764,8 +6764,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/r/subquery_sj_loosescan_bka.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka.result 2012-02-23 18:36:17 +0000
@@ -5174,9 +5174,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5188,14 +5188,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6765,8 +6765,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result 2012-02-23 18:36:17 +0000
@@ -5181,9 +5181,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5195,14 +5195,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; End temporary
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ref t1_IDX t1_IDX 3 test.t3.EMPNUM 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6772,8 +6772,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/r/subquery_sj_loosescan_bkaunique.result'
--- a/mysql-test/r/subquery_sj_loosescan_bkaunique.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bkaunique.result 2012-02-23 18:36:17 +0000
@@ -5175,9 +5175,9 @@ WHERE PNUM IN
FROM t2
WHERE PTYPE = 'Design'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
FROM t1
WHERE EMPNUM IN
@@ -5189,14 +5189,14 @@ WHERE EMPNUM IN
WHERE PTYPE = 'Design'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary
-1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (Block Nested Loop)
-1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; End temporary; Using join buffer (Block Nested Loop)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 12 Start temporary
+1 SIMPLE t1 ALL t1_IDX NULL NULL NULL 5 Using where; Using join buffer (Block Nested Loop)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (Block Nested Loop)
DEALLOCATE PREPARE stmt;
DROP INDEX t1_IDX ON t1;
EXPLAIN SELECT EMPNAME
@@ -6766,8 +6766,8 @@ AND grandparent1.col_varchar_key IS NOT
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY parent1 ALL NULL NULL NULL NULL 20 Start temporary
-2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where
-2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index; End temporary
+2 DEPENDENT SUBQUERY parent2 eq_ref PRIMARY PRIMARY 4 test.parent1.pk 1 Using index
+2 DEPENDENT SUBQUERY grandparent1 ref col_varchar_key col_varchar_key 3 test.parent1.col_varchar_nokey 1 Using where; End temporary
SELECT *
FROM t1
WHERE g1 NOT IN
=== modified file 'mysql-test/suite/innodb/t/innodb_bug34300.test'
--- a/mysql-test/suite/innodb/t/innodb_bug34300.test 2012-02-02 10:27:45 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug34300.test 2012-02-21 16:23:52 +0000
@@ -9,6 +9,7 @@
-- disable_result_log
call mtr.add_suppression("InnoDB: Warning: a long semaphore wait:");
+call mtr.add_suppression("the age of the last checkpoint is");
# set packet size and reconnect
let $max_packet=`select @@global.max_allowed_packet`;
=== modified file 'mysql-test/suite/opt_trace/r/bugs_no_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/bugs_no_prot_all.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_no_prot_all.result 2012-02-23 18:36:17 +0000
@@ -1260,77 +1260,137 @@ ON table2 .col_int_key = table1 .col_int
"considered_execution_plans": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "usable": false,
- "chosen": false
- },
- {
"access_type": "scan",
- "rows": 4,
- "cost": 2.0068,
+ "rows": 6,
+ "cost": 2.019,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 2.8068,
- "rows_for_plan": 4,
+ "cost_for_plan": 3.219,
+ "rows_for_plan": 6,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 4.493,
+ "cost": 6.5395,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2071,
+ "cost": 2.208,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 7.414,
- "rows_for_plan": 12,
+ "cost_for_plan": 9.0271,
+ "rows_for_plan": 18,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 18.819,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0209,
+ "rows": 3,
+ "cost": 2.2118,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 23.835,
- "rows_for_plan": 72,
+ "cost_for_plan": 22.039,
+ "rows_for_plan": 54,
"semijoin_strategy_choice": [
{
- "strategy": "DuplicatesWeedout",
- "cost": 41.435,
+ "strategy": "FirstMatch",
+ "recalculate_access_paths_and_cost": {
+ "tables": [
+ {
+ "database": "test",
+ "table": "table1",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 13.241,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ },
+ {
+ "database": "test",
+ "table": "table2",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 12.679,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 26.482,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ }
+ ] /* tables */
+ } /* recalculate_access_paths_and_cost */,
+ "cost": 28.838,
"rows": 6,
- "duplicate_tables_left": true,
"chosen": true
+ },
+ {
+ "strategy": "MaterializeLookup",
+ "cost": 16.233,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": true
+ },
+ {
+ "strategy": "DuplicatesWeedout",
+ "cost": 36.039,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": false
}
] /* semijoin_strategy_choice */,
"chosen": true
@@ -1339,53 +1399,119 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0194,
+ "rows": 3,
+ "cost": 2.208,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.6262,
- "rows_for_plan": 24,
+ "cost_for_plan": 9.0271,
+ "rows_for_plan": 18,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 24.958,
+ "cost": 18.819,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2135,
+ "cost": 2.2118,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 26.24,
- "rows_for_plan": 72,
+ "cost_for_plan": 22.039,
+ "rows_for_plan": 54,
"semijoin_strategy_choice": [
{
- "strategy": "DuplicatesWeedout",
- "cost": 43.84,
+ "strategy": "FirstMatch",
+ "recalculate_access_paths_and_cost": {
+ "tables": [
+ {
+ "database": "test",
+ "table": "table2",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 13.241,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ },
+ {
+ "database": "test",
+ "table": "table1",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 12.679,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 26.482,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ }
+ ] /* tables */
+ } /* recalculate_access_paths_and_cost */,
+ "cost": 28.838,
"rows": 6,
- "duplicate_tables_left": true,
"chosen": true
+ },
+ {
+ "strategy": "MaterializeLookup",
+ "cost": 16.233,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": true
+ },
+ {
+ "strategy": "DuplicatesWeedout",
+ "cost": 36.039,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": false
}
] /* semijoin_strategy_choice */,
"pruned_by_cost": true
@@ -1396,14 +1522,13 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
- "rows": 2e308,
- "cost": 0,
+ "usable": false,
"chosen": false
},
{
@@ -1421,50 +1546,50 @@ ON table2 .col_int_key = table1 .col_int
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 4.493,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2071,
+ "rows": 6,
+ "cost": 2.0194,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 7.414,
- "rows_for_plan": 12,
+ "cost_for_plan": 9.6262,
+ "rows_for_plan": 24,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 24.958,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0209,
+ "rows": 3,
+ "cost": 2.2135,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 23.835,
+ "cost_for_plan": 26.24,
"rows_for_plan": 72,
"semijoin_strategy_choice": [
{
"strategy": "DuplicatesWeedout",
- "cost": 41.435,
+ "cost": 43.84,
"rows": 6,
"duplicate_tables_left": true,
"chosen": true
@@ -1476,50 +1601,50 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 4.493,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0194,
+ "rows": 3,
+ "cost": 2.2071,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.6262,
- "rows_for_plan": 24,
+ "cost_for_plan": 7.414,
+ "rows_for_plan": 12,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 24.958,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2135,
+ "rows": 6,
+ "cost": 2.0209,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 26.24,
+ "cost_for_plan": 23.835,
"rows_for_plan": 72,
"semijoin_strategy_choice": [
{
"strategy": "DuplicatesWeedout",
- "cost": 43.84,
+ "cost": 41.435,
"rows": 6,
"duplicate_tables_left": true,
"chosen": true
@@ -1533,258 +1658,133 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2e308,
+ "cost": 0,
+ "chosen": false
+ },
+ {
"access_type": "scan",
- "rows": 6,
- "cost": 2.019,
+ "rows": 4,
+ "cost": 2.0068,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 3.219,
- "rows_for_plan": 6,
+ "cost_for_plan": 2.8068,
+ "rows_for_plan": 4,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.208,
+ "rows": 6,
+ "cost": 2.0194,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.0271,
- "rows_for_plan": 18,
+ "cost_for_plan": 9.6262,
+ "rows_for_plan": 24,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 18.819,
+ "cost": 24.958,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2118,
+ "cost": 2.2135,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 22.039,
- "rows_for_plan": 54,
+ "cost_for_plan": 26.24,
+ "rows_for_plan": 72,
"semijoin_strategy_choice": [
{
- "strategy": "FirstMatch",
- "recalculate_access_paths_and_cost": {
- "tables": [
- {
- "database": "test",
- "table": "table1",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 13.241,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- },
- {
- "database": "test",
- "table": "table2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 12.679,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 26.482,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- }
- ] /* tables */
- } /* recalculate_access_paths_and_cost */,
- "cost": 28.838,
- "rows": 6,
- "chosen": true
- },
- {
- "strategy": "MaterializeLookup",
- "cost": 16.233,
- "rows": 6,
- "duplicate_tables_left": false,
- "chosen": true
- },
- {
"strategy": "DuplicatesWeedout",
- "cost": 36.039,
+ "cost": 43.84,
"rows": 6,
- "duplicate_tables_left": false,
- "chosen": false
+ "duplicate_tables_left": true,
+ "chosen": true
}
] /* semijoin_strategy_choice */,
- "chosen": true
+ "pruned_by_cost": true
}
] /* rest_of_plan */
},
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 6.5395,
+ "cost": 4.493,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.208,
+ "cost": 2.2071,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.0271,
- "rows_for_plan": 18,
+ "cost_for_plan": 7.414,
+ "rows_for_plan": 12,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 18.819,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2118,
+ "rows": 6,
+ "cost": 2.0209,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 22.039,
- "rows_for_plan": 54,
+ "cost_for_plan": 23.835,
+ "rows_for_plan": 72,
"semijoin_strategy_choice": [
{
- "strategy": "FirstMatch",
- "recalculate_access_paths_and_cost": {
- "tables": [
- {
- "database": "test",
- "table": "table2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 13.241,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- },
- {
- "database": "test",
- "table": "table1",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 12.679,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 26.482,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- }
- ] /* tables */
- } /* recalculate_access_paths_and_cost */,
- "cost": 28.838,
- "rows": 6,
- "chosen": true
- },
- {
- "strategy": "MaterializeLookup",
- "cost": 16.233,
- "rows": 6,
- "duplicate_tables_left": false,
- "chosen": true
- },
- {
"strategy": "DuplicatesWeedout",
- "cost": 36.039,
+ "cost": 41.435,
"rows": 6,
- "duplicate_tables_left": false,
- "chosen": false
+ "duplicate_tables_left": true,
+ "chosen": true
}
] /* semijoin_strategy_choice */,
"pruned_by_cost": true
@@ -2291,14 +2291,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
"table": "t1"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_execution": {
- "select#": 2,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -2312,6 +2305,13 @@ SELECT 1 FROM t1 WHERE 1 LIKE
} /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_execution": {
+ "select#": 2,
+ "steps": [
+ ] /* steps */
} /* join_execution */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/bugs_no_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result 2012-02-23 18:36:17 +0000
@@ -1758,14 +1758,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
"table": "t1"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_execution": {
- "select#": 2,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -1779,6 +1772,13 @@ SELECT 1 FROM t1 WHERE 1 LIKE
} /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_execution": {
+ "select#": 2,
+ "steps": [
+ ] /* steps */
} /* join_execution */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result 2012-02-23 18:36:17 +0000
@@ -1260,77 +1260,137 @@ ON table2 .col_int_key = table1 .col_int
"considered_execution_plans": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "usable": false,
- "chosen": false
- },
- {
"access_type": "scan",
- "rows": 4,
- "cost": 2.0068,
+ "rows": 6,
+ "cost": 2.019,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 2.8068,
- "rows_for_plan": 4,
+ "cost_for_plan": 3.219,
+ "rows_for_plan": 6,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 4.493,
+ "cost": 6.5395,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2071,
+ "cost": 2.208,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 7.414,
- "rows_for_plan": 12,
+ "cost_for_plan": 9.0271,
+ "rows_for_plan": 18,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 18.819,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0209,
+ "rows": 3,
+ "cost": 2.2118,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 23.835,
- "rows_for_plan": 72,
+ "cost_for_plan": 22.039,
+ "rows_for_plan": 54,
"semijoin_strategy_choice": [
{
- "strategy": "DuplicatesWeedout",
- "cost": 41.435,
+ "strategy": "FirstMatch",
+ "recalculate_access_paths_and_cost": {
+ "tables": [
+ {
+ "database": "test",
+ "table": "table1",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 13.241,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ },
+ {
+ "database": "test",
+ "table": "table2",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 12.679,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 26.482,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ }
+ ] /* tables */
+ } /* recalculate_access_paths_and_cost */,
+ "cost": 28.838,
"rows": 6,
- "duplicate_tables_left": true,
"chosen": true
+ },
+ {
+ "strategy": "MaterializeLookup",
+ "cost": 16.233,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": true
+ },
+ {
+ "strategy": "DuplicatesWeedout",
+ "cost": 36.039,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": false
}
] /* semijoin_strategy_choice */,
"chosen": true
@@ -1339,53 +1399,119 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0194,
+ "rows": 3,
+ "cost": 2.208,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.6262,
- "rows_for_plan": 24,
+ "cost_for_plan": 9.0271,
+ "rows_for_plan": 18,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 24.958,
+ "cost": 18.819,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2135,
+ "cost": 2.2118,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 26.24,
- "rows_for_plan": 72,
+ "cost_for_plan": 22.039,
+ "rows_for_plan": 54,
"semijoin_strategy_choice": [
{
- "strategy": "DuplicatesWeedout",
- "cost": 43.84,
+ "strategy": "FirstMatch",
+ "recalculate_access_paths_and_cost": {
+ "tables": [
+ {
+ "database": "test",
+ "table": "table2",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 6.5395,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 13.241,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ },
+ {
+ "database": "test",
+ "table": "table1",
+ "best_access_path": {
+ "considered_access_paths": [
+ {
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 12.679,
+ "chosen": true
+ },
+ {
+ "access_type": "scan",
+ "rows": 3,
+ "cost": 26.482,
+ "chosen": false
+ }
+ ] /* considered_access_paths */
+ } /* best_access_path */
+ }
+ ] /* tables */
+ } /* recalculate_access_paths_and_cost */,
+ "cost": 28.838,
"rows": 6,
- "duplicate_tables_left": true,
"chosen": true
+ },
+ {
+ "strategy": "MaterializeLookup",
+ "cost": 16.233,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": true
+ },
+ {
+ "strategy": "DuplicatesWeedout",
+ "cost": 36.039,
+ "rows": 6,
+ "duplicate_tables_left": false,
+ "chosen": false
}
] /* semijoin_strategy_choice */,
"pruned_by_cost": true
@@ -1396,14 +1522,13 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
- "rows": 2e308,
- "cost": 0,
+ "usable": false,
"chosen": false
},
{
@@ -1421,50 +1546,50 @@ ON table2 .col_int_key = table1 .col_int
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 4.493,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2071,
+ "rows": 6,
+ "cost": 2.0194,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 7.414,
- "rows_for_plan": 12,
+ "cost_for_plan": 9.6262,
+ "rows_for_plan": 24,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 24.958,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0209,
+ "rows": 3,
+ "cost": 2.2135,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 23.835,
+ "cost_for_plan": 26.24,
"rows_for_plan": 72,
"semijoin_strategy_choice": [
{
"strategy": "DuplicatesWeedout",
- "cost": 41.435,
+ "cost": 43.84,
"rows": 6,
"duplicate_tables_left": true,
"chosen": true
@@ -1476,50 +1601,50 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2,
+ "cost": 4.493,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
- "rows": 6,
- "cost": 2.0194,
+ "rows": 3,
+ "cost": 2.2071,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.6262,
- "rows_for_plan": 24,
+ "cost_for_plan": 7.414,
+ "rows_for_plan": 12,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 24.958,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2135,
+ "rows": 6,
+ "cost": 2.0209,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 26.24,
+ "cost_for_plan": 23.835,
"rows_for_plan": 72,
"semijoin_strategy_choice": [
{
"strategy": "DuplicatesWeedout",
- "cost": 43.84,
+ "cost": 41.435,
"rows": 6,
"duplicate_tables_left": true,
"chosen": true
@@ -1533,258 +1658,133 @@ ON table2 .col_int_key = table1 .col_int
},
{
"database": "test",
- "table": "where_subselect_20070",
+ "table": "table2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_int_key",
+ "rows": 2e308,
+ "cost": 0,
+ "chosen": false
+ },
+ {
"access_type": "scan",
- "rows": 6,
- "cost": 2.019,
+ "rows": 4,
+ "cost": 2.0068,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 3.219,
- "rows_for_plan": 6,
+ "cost_for_plan": 2.8068,
+ "rows_for_plan": 4,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.208,
+ "rows": 6,
+ "cost": 2.0194,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.0271,
- "rows_for_plan": 18,
+ "cost_for_plan": 9.6262,
+ "rows_for_plan": 24,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 18.819,
+ "cost": 24.958,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.2118,
+ "cost": 2.2135,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 22.039,
- "rows_for_plan": 54,
+ "cost_for_plan": 26.24,
+ "rows_for_plan": 72,
"semijoin_strategy_choice": [
{
- "strategy": "FirstMatch",
- "recalculate_access_paths_and_cost": {
- "tables": [
- {
- "database": "test",
- "table": "table1",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 13.241,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- },
- {
- "database": "test",
- "table": "table2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 12.679,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 26.482,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- }
- ] /* tables */
- } /* recalculate_access_paths_and_cost */,
- "cost": 28.838,
- "rows": 6,
- "chosen": true
- },
- {
- "strategy": "MaterializeLookup",
- "cost": 16.233,
- "rows": 6,
- "duplicate_tables_left": false,
- "chosen": true
- },
- {
"strategy": "DuplicatesWeedout",
- "cost": 36.039,
+ "cost": 43.84,
"rows": 6,
- "duplicate_tables_left": false,
- "chosen": false
+ "duplicate_tables_left": true,
+ "chosen": true
}
] /* semijoin_strategy_choice */,
- "chosen": true
+ "pruned_by_cost": true
}
] /* rest_of_plan */
},
{
"database": "test",
- "table": "table2",
+ "table": "table1",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "col_int_key",
"rows": 2,
- "cost": 6.5395,
+ "cost": 4.493,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.208,
+ "cost": 2.2071,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 9.0271,
- "rows_for_plan": 18,
+ "cost_for_plan": 7.414,
+ "rows_for_plan": 12,
"semijoin_strategy_choice": [
] /* semijoin_strategy_choice */,
"rest_of_plan": [
{
"database": "test",
- "table": "table1",
+ "table": "where_subselect_20070",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 18.819,
- "chosen": true
- },
- {
"access_type": "scan",
"using_join_cache": true,
- "rows": 3,
- "cost": 2.2118,
+ "rows": 6,
+ "cost": 2.0209,
"chosen": true
}
] /* considered_access_paths */
} /* best_access_path */,
- "cost_for_plan": 22.039,
- "rows_for_plan": 54,
+ "cost_for_plan": 23.835,
+ "rows_for_plan": 72,
"semijoin_strategy_choice": [
{
- "strategy": "FirstMatch",
- "recalculate_access_paths_and_cost": {
- "tables": [
- {
- "database": "test",
- "table": "table2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 6.5395,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 13.241,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- },
- {
- "database": "test",
- "table": "table1",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_int_key",
- "rows": 2,
- "cost": 12.679,
- "chosen": true
- },
- {
- "access_type": "scan",
- "rows": 3,
- "cost": 26.482,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */
- }
- ] /* tables */
- } /* recalculate_access_paths_and_cost */,
- "cost": 28.838,
- "rows": 6,
- "chosen": true
- },
- {
- "strategy": "MaterializeLookup",
- "cost": 16.233,
- "rows": 6,
- "duplicate_tables_left": false,
- "chosen": true
- },
- {
"strategy": "DuplicatesWeedout",
- "cost": 36.039,
+ "cost": 41.435,
"rows": 6,
- "duplicate_tables_left": false,
- "chosen": false
+ "duplicate_tables_left": true,
+ "chosen": true
}
] /* semijoin_strategy_choice */,
"pruned_by_cost": true
@@ -2291,14 +2291,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
"table": "t1"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_execution": {
- "select#": 2,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -2312,6 +2305,13 @@ SELECT 1 FROM t1 WHERE 1 LIKE
} /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_execution": {
+ "select#": 2,
+ "steps": [
+ ] /* steps */
} /* join_execution */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result 2012-02-23 18:36:17 +0000
@@ -1738,14 +1738,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
"table": "t1"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_execution": {
- "select#": 2,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -1759,6 +1752,13 @@ SELECT 1 FROM t1 WHERE 1 LIKE
} /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_execution": {
+ "select#": 2,
+ "steps": [
+ ] /* steps */
} /* join_execution */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/range_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_no_prot.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/range_no_prot.result 2012-02-23 18:36:17 +0000
@@ -879,14 +879,6 @@ EXPLAIN SELECT key2, MIN(key2_1) FROM t2
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -1112,10 +1104,6 @@ EXPLAIN SELECT DISTINCT key2 FROM t2 {
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -1426,14 +1414,6 @@ GROUP BY key2 {
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -4658,14 +4638,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2'
"access_type": "range"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"rows_estimation": {
@@ -4743,12 +4716,15 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2'
"access_type": "range"
} /* index_order_summary */
} /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_explain": {
+ "select#": 1,
+ "steps": [
+ ] /* steps */
} /* join_explain */
}
] /* steps */
@@ -5094,30 +5070,6 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- "index_order_summary": {
- "database": "test",
- "table": "t1",
- "index": "k1",
- "order_direction": "desc",
- "plan_changed": true,
- "access_type": "index_scan"
- } /* index_order_summary */
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- "index_order_summary": {
- "database": "test",
- "table": "t1",
- "index": "k1",
- "order_direction": "desc",
- "plan_changed": true,
- "access_type": "index_scan"
- } /* index_order_summary */
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -6266,14 +6218,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1'
"table_condition_attached": null
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -6286,12 +6231,15 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1'
"access_type": "ref"
} /* index_order_summary */
} /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_explain": {
+ "select#": 1,
+ "steps": [
+ ] /* steps */
} /* join_explain */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/range_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_ps_prot.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/range_ps_prot.result 2012-02-23 18:36:17 +0000
@@ -879,14 +879,6 @@ EXPLAIN SELECT key2, MIN(key2_1) FROM t2
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -1112,10 +1104,6 @@ EXPLAIN SELECT DISTINCT key2 FROM t2 {
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -1426,14 +1414,6 @@ GROUP BY key2 {
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -4658,14 +4638,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2'
"access_type": "range"
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"rows_estimation": {
@@ -4743,12 +4716,15 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2'
"access_type": "range"
} /* index_order_summary */
} /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_explain": {
+ "select#": 1,
+ "steps": [
+ ] /* steps */
} /* join_explain */
}
] /* steps */
@@ -5094,30 +5070,6 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
"join_explain": {
"select#": 1,
"steps": [
- {
- "reconsidering_access_paths_for_index_ordering": {
- "index_order_summary": {
- "database": "test",
- "table": "t1",
- "index": "k1",
- "order_direction": "desc",
- "plan_changed": true,
- "access_type": "index_scan"
- } /* index_order_summary */
- } /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- "index_order_summary": {
- "database": "test",
- "table": "t1",
- "index": "k1",
- "order_direction": "desc",
- "plan_changed": true,
- "access_type": "index_scan"
- } /* index_order_summary */
- } /* reconsidering_access_paths_for_index_ordering */
- }
] /* steps */
} /* join_explain */
}
@@ -6266,14 +6218,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1'
"table_condition_attached": null
}
] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
+ },
{
"reconsidering_access_paths_for_index_ordering": {
"index_order_summary": {
@@ -6286,12 +6231,15 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1'
"access_type": "ref"
} /* index_order_summary */
} /* reconsidering_access_paths_for_index_ordering */
- },
- {
- "reconsidering_access_paths_for_index_ordering": {
- } /* reconsidering_access_paths_for_index_ordering */
}
] /* steps */
+ } /* join_optimization */
+ },
+ {
+ "join_explain": {
+ "select#": 1,
+ "steps": [
+ ] /* steps */
} /* join_explain */
}
] /* steps */
=== modified file 'mysql-test/suite/opt_trace/r/subquery_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/subquery_no_prot.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/subquery_no_prot.result 2012-02-23 18:36:17 +0000
@@ -1564,16 +1564,10 @@ field4,field5,field6 {
"considered_execution_plans": [
{
"database": "test",
- "table": "sq1_alias2",
+ "table": "sq1_alias3",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_varchar_key",
- "usable": false,
- "chosen": false
- },
- {
"access_type": "scan",
"rows": 3,
"cost": 2.0342,
@@ -1586,14 +1580,21 @@ field4,field5,field6 {
"rest_of_plan": [
{
"database": "test",
- "table": "sq1_alias3",
+ "table": "sq1_alias2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_varchar_key",
+ "rows": 1,
+ "cost": 4.1,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.0345,
+ "cost": 2.0344,
"chosen": true
}
] /* considered_access_paths */
@@ -1606,10 +1607,16 @@ field4,field5,field6 {
},
{
"database": "test",
- "table": "sq1_alias3",
+ "table": "sq1_alias2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_varchar_key",
+ "usable": false,
+ "chosen": false
+ },
+ {
"access_type": "scan",
"rows": 3,
"cost": 2.0342,
@@ -1619,33 +1626,7 @@ field4,field5,field6 {
} /* best_access_path */,
"cost_for_plan": 2.6342,
"rows_for_plan": 3,
- "rest_of_plan": [
- {
- "database": "test",
- "table": "sq1_alias2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_varchar_key",
- "rows": 1,
- "cost": 4.1,
- "chosen": true
- },
- {
- "access_type": "scan",
- "using_join_cache": true,
- "rows": 3,
- "cost": 2.0344,
- "chosen": true
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 6.4686,
- "rows_for_plan": 9,
- "pruned_by_cost": true
- }
- ] /* rest_of_plan */
+ "pruned_by_heuristic": true
}
] /* considered_execution_plans */
}
=== modified file 'mysql-test/suite/opt_trace/r/subquery_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/subquery_ps_prot.result 2012-02-23 13:02:50 +0000
+++ b/mysql-test/suite/opt_trace/r/subquery_ps_prot.result 2012-02-23 18:36:17 +0000
@@ -1542,16 +1542,10 @@ field4,field5,field6 {
"considered_execution_plans": [
{
"database": "test",
- "table": "sq1_alias2",
+ "table": "sq1_alias3",
"best_access_path": {
"considered_access_paths": [
{
- "access_type": "ref",
- "index": "col_varchar_key",
- "usable": false,
- "chosen": false
- },
- {
"access_type": "scan",
"rows": 3,
"cost": 2.0342,
@@ -1564,14 +1558,21 @@ field4,field5,field6 {
"rest_of_plan": [
{
"database": "test",
- "table": "sq1_alias3",
+ "table": "sq1_alias2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_varchar_key",
+ "rows": 1,
+ "cost": 4.1,
+ "chosen": true
+ },
+ {
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
- "cost": 2.0345,
+ "cost": 2.0344,
"chosen": true
}
] /* considered_access_paths */
@@ -1584,10 +1585,16 @@ field4,field5,field6 {
},
{
"database": "test",
- "table": "sq1_alias3",
+ "table": "sq1_alias2",
"best_access_path": {
"considered_access_paths": [
{
+ "access_type": "ref",
+ "index": "col_varchar_key",
+ "usable": false,
+ "chosen": false
+ },
+ {
"access_type": "scan",
"rows": 3,
"cost": 2.0342,
@@ -1597,33 +1604,7 @@ field4,field5,field6 {
} /* best_access_path */,
"cost_for_plan": 2.6342,
"rows_for_plan": 3,
- "rest_of_plan": [
- {
- "database": "test",
- "table": "sq1_alias2",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "col_varchar_key",
- "rows": 1,
- "cost": 4.1,
- "chosen": true
- },
- {
- "access_type": "scan",
- "using_join_cache": true,
- "rows": 3,
- "cost": 2.0344,
- "chosen": true
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 6.4686,
- "rows_for_plan": 9,
- "pruned_by_cost": true
- }
- ] /* rest_of_plan */
+ "pruned_by_heuristic": true
}
] /* considered_execution_plans */
}
=== modified file 'mysql-test/suite/parts/t/partition_alter4_myisam.test'
--- a/mysql-test/suite/parts/t/partition_alter4_myisam.test 2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_alter4_myisam.test 2012-02-23 11:51:35 +0000
@@ -45,6 +45,8 @@ let $more_pk_ui_tests= 0;
# Does not work with --embedded
--source include/not_embedded.inc
+# This test takes long time, so only run it with the --big mtr-flag.
+--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
=== modified file 'mysql-test/suite/rpl/t/rpl_row_event_max_size.test'
--- a/mysql-test/suite/rpl/t/rpl_row_event_max_size.test 2012-01-30 15:01:17 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_event_max_size.test 2012-02-22 21:27:15 +0000
@@ -59,6 +59,9 @@ connection master;
CREATE TABLE t1 (a int not null auto_increment, data1 LONGBLOB,
data2 LONGBLOB, data3 LONGBLOB, PRIMARY KEY(a));
+--sync_slave_with_master
+--connection master
+
INSERT INTO t1 (data1, data2, data3) VALUES (repeat('a',1000000), repeat('a', 1000000), repeat('a', 1000000));
SELECT LENGTH(data1), LENGTH(data2), LENGTH(data3) FROM t1 WHERE a = 1;
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2012-02-15 11:09:43 +0000
+++ b/mysql-test/t/disabled.def 2012-02-23 05:57:45 +0000
@@ -14,4 +14,4 @@ read_many_rows_innodb : Bug#11748886
sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
-events_restart @windows : Bug#11748899 2012-02-15 agopi The test started failing on windows after the fix for bug#11748899
+events_restart @windows : Bug#11748899 2012-02-23 hemant The test started failing on windows after the fix for bug#11748899 and followup patch didnot work.
=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test 2011-12-22 13:36:08 +0000
+++ b/mysql-test/t/func_group.test 2012-02-22 09:26:19 +0000
@@ -1193,3 +1193,21 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
DROP TABLE t1;
+
+--echo #
+--echo # Bug#13724099 1032 BYTE MEMORY LEAK NEW_CACHED_ITEM IN
+--echo # SUBQUERY WITH GROUPING OF OUTER COLUMN
+--echo #
+
+CREATE TABLE t1 (
+ a BLOB,
+ b INT)
+engine=innodb;
+
+INSERT INTO t1 VALUES ('a', 0);
+
+SELECT 0 FROM t1
+WHERE 0 = (SELECT group_concat(b)
+ FROM t1 t GROUP BY t1.a)
+;
+DROP TABLE t1;
=== modified file 'mysql-test/t/func_set.test'
--- a/mysql-test/t/func_set.test 2012-01-10 08:24:24 +0000
+++ b/mysql-test/t/func_set.test 2012-02-22 08:57:27 +0000
@@ -131,3 +131,33 @@ SELECT COUNT(*) FROM t1 GROUP BY MAKE_SE
DROP TABLE t1;
--echo # End of test BUG#12211480
+
+--echo #
+--echo # Bug#12677197 MAKE_SET() AND MY_EMPTY_STRING BUGS CAUSE CRASHING
+--echo #
+
+do
+nullif( ( rtrim( make_set((cast(('%S') as unsigned)),
+ (point((0xaf),(''))))
+ )
+ ), (''))
+;
+
+do
+dayofmonth( ( not( trim( trailing( convert((''), binary(4)))
+ from( make_set( ('>>'), ('`'))))
+ )))
+;
+
+do quote(make_set((''), (cast(('-2147483649.1') as binary(513)))));
+
+do
+trim( both(-8388607)
+ from( make_set( ( extract( minute_second from
+ ( str_to_date((rpad(1.0,4,1)), ('')))
+ )
+ ),
+ ( char((connection_id()) using macce)))
+ )
+ )
+;
=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test 2012-01-25 15:49:57 +0000
+++ b/mysql-test/t/func_str.test 2012-02-23 10:08:33 +0000
@@ -1688,5 +1688,28 @@ SET NAMES latin2;
EXECUTE stmt;
--echo #
+--echo # Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED
+--echo # INSIDE LOWER()
+--echo #
+
+SET @user_at_host = 'root@stripped';
+SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));
+
+--echo # End of test BUG#11829861
+
+--echo #
+--echo # Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT
+--echo #
+
+CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL);
+INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom');
+SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1;
+SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t;
+
+DROP TABLE t;
+
+--echo # End of test BUG#42404
+
+--echo #
--echo # End of 5.6 tests
--echo #
=== added file 'mysql-test/t/greedy_search.test'
--- a/mysql-test/t/greedy_search.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/greedy_search.test 2012-02-23 11:22:34 +0000
@@ -0,0 +1,423 @@
+--echo #
+--echo # TEST 1
+--echo # Greedy search iteration test for 16-way join: star schema
+--echo #
+--echo # Creation of 16 tables hidden
+--echo #
+
+--disable_result_log
+--disable_query_log
+
+let $brands=7;
+let $models_pr_brand=5;
+let $misc_properties_big=20;
+let $misc_properties_small=10;
+let $vehicles=100;
+
+eval
+CREATE TABLE brands (
+ id_pk int PRIMARY KEY,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$brands)
+{
+ inc $i;
+ eval INSERT INTO brands VALUES ($i, $i, concat('brand',$i));
+}
+
+eval
+CREATE TABLE models (
+ id_pk int PRIMARY KEY,
+ id_nokey int,
+ brand_id int,
+ name varchar(100),
+ INDEX(`brand_id`)
+);
+
+let $i=0;
+let $cnt=0;
+while ($i<$brands)
+{
+ inc $i;
+ let $j=0;
+ while ($j<$models_pr_brand)
+ {
+ inc $cnt;
+ inc $j;
+ eval INSERT INTO models VALUES ($cnt, $cnt, $i, concat('brandmodel',$cnt));
+ }
+}
+
+eval
+CREATE TABLE subtypes (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO subtypes VALUES ($i, $i, concat('subtype',$i));
+}
+
+eval
+CREATE TABLE colors (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_big)
+{
+ inc $i;
+ eval INSERT INTO colors VALUES ($i, $i, concat('color',$i));
+}
+
+eval
+CREATE TABLE heating (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO heating VALUES ($i, $i, concat('heating',$i));
+}
+
+eval
+CREATE TABLE windows (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO windows VALUES ($i, $i, concat('window',$i));
+}
+
+eval
+CREATE TABLE fuels (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO fuels VALUES ($i, $i, concat('fuel',$i));
+}
+
+eval
+CREATE TABLE transmissions (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO transmissions VALUES ($i, $i, concat('transmission',$i));
+}
+
+eval
+CREATE TABLE steerings (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO steerings VALUES ($i, $i, concat('steering',$i));
+}
+
+eval
+CREATE TABLE interiors (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+
+let $i=0;
+while ($i<$misc_properties_big)
+{
+ inc $i;
+ eval INSERT INTO interiors VALUES ($i, $i, concat('interior',$i));
+}
+
+eval
+CREATE TABLE drives (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO drives VALUES ($i, $i, concat('drive',$i));
+}
+
+eval
+CREATE TABLE wheels (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO wheels VALUES ($i, $i, concat('wheel',$i));
+}
+
+eval
+CREATE TABLE engine (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO engine VALUES ($i, $i, concat('engine',$i));
+}
+
+eval
+CREATE TABLE price_ranges (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+let $i=0;
+while ($i<$misc_properties_small)
+{
+ inc $i;
+ eval INSERT INTO price_ranges VALUES ($i, $i, concat('price',$i));
+}
+
+eval
+CREATE TABLE countries (
+ id_pk int primary key,
+ id_nokey int,
+ name varchar(100)
+);
+let $i=0;
+while ($i<$misc_properties_big)
+{
+ inc $i;
+ eval INSERT INTO countries VALUES ($i, $i, concat('country',$i));
+}
+
+eval
+CREATE TABLE vehicles (
+ id int primary key,
+ model_id int,
+ subtype_id int,
+ color_id int,
+ heating_id int,
+ window_id int,
+ fuel_id int,
+ transmission_id int,
+ steering_id int,
+ interior_id int,
+ drive_id int,
+ price_range_id int,
+ assembled_in int,
+ engine_id int,
+ wheels_id int
+);
+
+
+let $brands=7;
+let $models_pr_brand=3;
+let $misc_properties_big=20;
+let $misc_properties_small=$misc_properties_big/2;
+
+while ($i<$vehicles)
+{
+ inc $i;
+ eval INSERT INTO vehicles VALUES ($i, $i%2, $i%3, $i%4, $i%5, $i%6, $i%7,
+ $i, $i%2, $i%3, $i%4, $i%5, $i%6, $i%7,
+ $i );
+}
+--enable_result_log
+--enable_query_log
+
+SET SESSION optimizer_search_depth = 25;
+# print_greedy_search_count will do it's own FLUSH STATUS after
+# executing each query, but we need to reset counters before
+# the first query is executed as well.
+FLUSH STATUS;
+
+--echo #
+--echo # 16-way join - all 15 fact tables joined on column with key
+--echo #
+
+let $query=
+SELECT *
+FROM vehicles
+ JOIN models ON vehicles.model_id = models.id_pk
+ JOIN subtypes ON vehicles.subtype_id = subtypes.id_pk
+ JOIN colors ON vehicles.color_id = colors.id_pk
+ JOIN heating ON vehicles.heating_id = heating.id_pk
+ JOIN windows ON vehicles.window_id = windows.id_pk
+ JOIN fuels ON vehicles.fuel_id = fuels.id_pk
+ JOIN transmissions ON vehicles.transmission_id = transmissions.id_pk
+ JOIN steerings ON vehicles.steering_id = steerings.id_pk
+ JOIN interiors ON vehicles.interior_id = interiors.id_pk
+ JOIN drives ON vehicles.drive_id = drives.id_pk
+ JOIN wheels ON vehicles.wheels_id = wheels.id_pk
+ JOIN engine ON vehicles.engine_id = engine.id_pk
+ JOIN price_ranges ON vehicles.price_range_id = price_ranges.id_pk
+ JOIN countries ON vehicles.assembled_in = countries.id_pk
+ JOIN brands ON models.brand_id = brands.id_pk;
+--source include/print_greedy_search_count.inc
+
+--echo #
+--echo # 16-way join - 10 fact tables joined on column with key and
+--echo # 5 fact tables joined on column without key
+--echo #
+
+let $query=
+SELECT *
+FROM vehicles
+ JOIN models ON vehicles.model_id = models.id_nokey
+ JOIN subtypes ON vehicles.subtype_id = subtypes.id_pk
+ JOIN colors ON vehicles.color_id = colors.id_pk
+ JOIN heating ON vehicles.heating_id = heating.id_nokey
+ JOIN windows ON vehicles.window_id = windows.id_pk
+ JOIN fuels ON vehicles.fuel_id = fuels.id_pk
+ JOIN transmissions ON vehicles.transmission_id = transmissions.id_nokey
+ JOIN steerings ON vehicles.steering_id = steerings.id_pk
+ JOIN interiors ON vehicles.interior_id = interiors.id_pk
+ JOIN drives ON vehicles.drive_id = drives.id_pk
+ JOIN wheels ON vehicles.wheels_id = wheels.id_nokey
+ JOIN engine ON vehicles.engine_id = engine.id_pk
+ JOIN price_ranges ON vehicles.price_range_id = price_ranges.id_pk
+ JOIN countries ON vehicles.assembled_in = countries.id_pk
+ JOIN brands ON models.brand_id = brands.id_nokey;
+--source include/print_greedy_search_count.inc
+
+select @@optimizer_search_depth;
+select @@optimizer_prune_level;
+
+DROP TABLE vehicles, models, subtypes, colors, heating, windows,
+ fuels, transmissions, steerings, interiors, drives,
+ price_ranges, countries, brands, wheels, engine;
+
+
+--echo #
+--echo # TEST 2
+--echo # Greedy search iteration test for chain of tables
+--echo #
+
+--source include/greedy_search_load_tables.inc
+
+# Explanation to the test
+#
+# A chain of tables is joined like this:
+# t1 JOIN t2 ON t1.<some_col>=t2.<some_col> JOIN t3 ON ...
+#
+# Different variants of table sizes and columns in the join conditions
+# are tested.
+#
+# The column names mean:
+# 'pk' - The column is primary key
+# 'colidx' - The column is indexed
+# 'col' - The column is not indexed
+#
+# The table names mean:
+# tx_y - table with x rows, y is simply used to get unique table names
+#
+# A comment explains each test. The notation used is
+# (...,tx_col_next):(ty_col_prev,...)
+# which means that table x is joined with table y with join condition
+# "ON tx.col_next = ty.col_prev" like this:
+# t1 JOIN t2 ON t1.col_next=t2.col_prev ...
+
+--echo #
+--echo # Chain test a: colidx):(pk,colidx):(pk,colidx)
+--echo #
+
+let $query= SELECT * FROM t10_1;
+let $i= 1;
+while ($i < 8)
+{
+ let $query= $query JOIN t100_$i ON t10_$i.colidx = t100_$i.pk;
+ let $j=$i;
+ inc $j;
+ let $query= $query JOIN t10_$j ON t100_$i.colidx = t10_$j.pk;
+ inc $i;
+}
+--source include/print_greedy_search_count.inc
+
+--echo #
+--echo # Chain test b: (...,col):(colidx, col):(pk,col):(colidx,col):(pk,...)
+--echo #
+let $query= SELECT * FROM t10_1;
+let $i= 1;
+while ($i < 8)
+{
+ let $query= $query JOIN t100_$i ON t10_$i.col = t100_$i.colidx;
+ let $j=$i;
+ inc $j;
+ let $query= $query JOIN t10_$j ON t100_$i.col = t10_$j.pk;
+ inc $i;
+}
+--source include/print_greedy_search_count.inc
+
+--echo #
+--echo # Chain test c: (...,colidx):(col, pk):(col,colidx):(col,...)
+--echo #
+let $query= SELECT * FROM t10_1;
+let $i= 1;
+while ($i < 8)
+{
+ let $query= $query JOIN t100_$i ON t10_$i.colidx = t100_$i.col;
+ let $j=$i;
+ inc $j;
+ let $query= $query JOIN t10_$j ON t100_$i.pk = t10_$j.col;
+ inc $i;
+}
+--source include/print_greedy_search_count.inc
+
+--echo #
+--echo # Chain test d: (...,colidx):(pk, col):(pk,colidx):(pk,col):(pk,...)
+--echo #
+let $query= SELECT * FROM t10_1;
+let $i= 1;
+while ($i < 8)
+{
+ let $query= $query JOIN t100_$i ON t10_$i.colidx = t100_$i.pk;
+ let $j=$i;
+ inc $j;
+ let $query= $query JOIN t10_$j ON t100_$i.col = t10_$j.pk;
+ inc $i;
+}
+--source include/print_greedy_search_count.inc
+
+--echo #
+--echo # Cleanup after TEST 2
+--echo #
+
+--source include/greedy_search_drop_tables.inc
=== modified file 'mysql-test/t/innodb_ignore_builtin.test'
--- a/mysql-test/t/innodb_ignore_builtin.test 2009-02-09 15:03:52 +0000
+++ b/mysql-test/t/innodb_ignore_builtin.test 2012-02-20 11:54:49 +0000
@@ -1,6 +1,12 @@
#
# Bug #42610: Dynamic plugin broken in 5.1.31
#
+# ignore_builtin_innodb is ignored in MySQL 5.6 (start with InnoDB regardless
+# of the value of that option).
+#
+
+call mtr.add_suppression("is ignored and will be removed in future releases");
+
show variables like 'ignore_builtin_innodb';
select PLUGIN_NAME from information_schema.plugins
where PLUGIN_NAME = "InnoDb";
=== added file 'mysql-test/t/mysql_client_test_embedded.cnf'
--- a/mysql-test/t/mysql_client_test_embedded.cnf 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_client_test_embedded.cnf 2011-12-05 10:11:58 +0000
@@ -0,0 +1,6 @@
+# Include original my.cnf
+!include include/default_my.cnf
+
+[embedded]
+# Can't run with innodb currently, since mysqltest_embedded have it locked
+innodb=OFF
=== added file 'mysql-test/t/mysql_client_test_embedded.test'
--- a/mysql-test/t/mysql_client_test_embedded.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_client_test_embedded.test 2012-02-23 10:39:15 +0000
@@ -0,0 +1,8 @@
+--source include/is_embedded.inc
+
+--echo # Run the start/stop test 17 times (* 64 = 1088 restarts)
+--echo # --silent to avoid printing out server version etc.
+--exec $MYSQL_CLIENT_TEST --silent --count=17 test_embedded_start_stop > $MYSQLTEST_VARDIR/log/test_embedded_start_stop.log 2>&1
+# TODO: Test all other tests once.
+# (Currently not done, since many fail with embedded server).
+#--exec $MYSQL_CLIENT_TEST > $MYSQLTEST_VARDIR/log/mysql_client_test_embedded.log 2>&1
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2012-02-17 10:30:31 +0000
+++ b/sql/item_strfunc.cc 2012-02-23 10:08:33 +0000
@@ -58,11 +58,6 @@ C_MODE_END
using std::min;
using std::max;
-/**
- @todo Remove this. It is not safe to use a shared String object.
- */
-String my_empty_string("",default_charset_info);
-
/*
For the Items which have only val_str_ascii() method
and don't have their own "native" val_str(),
@@ -1571,10 +1566,12 @@ void Item_func_substr_index::fix_length_
String *Item_func_substr_index::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
+ char buff[MAX_FIELD_WIDTH];
+ String tmp(buff,sizeof(buff),system_charset_info);
String *res= args[0]->val_str(str);
- String *delimiter= args[1]->val_str(&tmp_value);
+ String *delimiter= args[1]->val_str(&tmp);
int32 count= (int32) args[2]->val_int();
- uint offset;
+ int offset;
if (args[0]->null_value || args[1]->null_value || args[2]->null_value)
{ // string and/or delim are null
@@ -1645,7 +1642,7 @@ String *Item_func_substr_index::val_str(
{ // start counting from the beginning
for (offset=0; ; offset+= delimiter_length)
{
- if ((int) (offset= res->strstr(*delimiter, offset)) < 0)
+ if ((offset= res->strstr(*delimiter, offset)) < 0)
return res; // Didn't find, return org string
if (!--count)
{
@@ -1659,14 +1656,14 @@ String *Item_func_substr_index::val_str(
/*
Negative index, start counting at the end
*/
- for (offset=res->length(); offset ;)
+ for (offset=res->length(); offset; )
{
/*
this call will result in finding the position pointing to one
address space less than where the found substring is located
in res
*/
- if ((int) (offset= res->strrstr(*delimiter, offset)) < 0)
+ if ((offset= res->strrstr(*delimiter, offset)) < 0)
return res; // Didn't find, return org string
/*
At this point, we've searched for the substring
@@ -1679,14 +1676,10 @@ String *Item_func_substr_index::val_str(
break;
}
}
+ if (count)
+ return res; // Didn't find, return org string
}
}
- /*
- We always mark tmp_value as const so that if val_str() is called again
- on this object, we don't disrupt the contents of tmp_value when it was
- derived from another String.
- */
- tmp_value.mark_as_const();
return (&tmp_value);
}
@@ -2599,7 +2592,7 @@ String *Item_func_make_set::val_str(Stri
ulonglong bits;
bool first_found=0;
Item **ptr=args;
- String *result=&my_empty_string;
+ String *result= NULL;
bits=item->val_int();
if ((null_value=item->null_value))
@@ -2631,17 +2624,21 @@ String *Item_func_make_set::val_str(Stri
{
if (result != &tmp_str)
{ // Copy data to tmp_str
- if (tmp_str.alloc(result->length()+res->length()+1) ||
+ if (tmp_str.alloc((result != NULL ? result->length() : 0) +
+ res->length() + 1) ||
tmp_str.copy(*result))
return make_empty_result();
result= &tmp_str;
}
- if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
+ if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) ||
+ tmp_str.append(*res))
return make_empty_result();
}
}
}
}
+ if (result == NULL)
+ return make_empty_result();
return result;
}
=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h 2012-01-10 08:24:24 +0000
+++ b/sql/item_strfunc.h 2012-02-22 08:57:27 +0000
@@ -989,6 +989,4 @@ public:
String *val_str(String *);
};
-extern String my_empty_string;
-
#endif /* ITEM_STRFUNC_INCLUDED */
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2012-02-07 23:33:54 +0000
+++ b/sql/log_event.cc 2012-02-22 08:57:27 +0000
@@ -6113,6 +6113,7 @@ int Load_log_event::do_apply_event(NET*
String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
+ const String empty_str("", 0, log_cs);
ex.field_term= &field_term;
ex.enclosed= &enclosed;
ex.line_term= &line_term;
@@ -6121,7 +6122,7 @@ int Load_log_event::do_apply_event(NET*
ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
- ex.field_term->length(0);
+ ex.field_term= &empty_str;
ex.skip_lines = skip_lines;
List<Item> field_list;
=== added file 'sql/merge_sort.h'
--- a/sql/merge_sort.h 1970-01-01 00:00:00 +0000
+++ b/sql/merge_sort.h 2012-02-23 11:22:34 +0000
@@ -0,0 +1,145 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef MERGE_SORT_INCLUDED
+#define MERGE_SORT_INCLUDED
+
+/**
+ @file
+
+ @brief
+ Merge sort and insert sort implementations. These sorting functions
+ are primarily intended for sorting of JOIN_TABs before the greedy
+ search algorithm is applied. Since the JOIN_TAB comparison functions
+ (Join_tab_compare*) are not transitive, the resulting order depends
+ on the sorting implementation to a certain degree.
+
+ Since the std::stable_sort and std::sort implementations differ
+ between platforms, the result of sorting JOIN_TABs may also differ.
+ In turn, the query execution plan would differ between platforms and
+ that is a problem with mtr tests (EXPLAIN output would vary).
+
+ If you intend to sort something transitive (which means almost
+ everything except JOIN_TABs) you should most likely use one of the
+ std sorting functions instead of this.
+*/
+
+#include "sql_select.h"
+#include <queue>
+
+/**
+ Sorts the elements in the range [first,last) into ascending order
+ using insertion sort.
+
+ @param first First element in an array of pointers to be sorted
+ @param last Element after the last element in an array of pointers
+ to be sorted
+ @param comp Comparison function object that, taking two pointers
+ of the same type as those contained in the range,
+ returns true if the first argument goes before the
+ second argument in the specific strict weak ordering
+ it defines, and false otherwise.
+
+ In our case comp should be a function object with an operator:
+
+ bool operator()(Element_type*, Element_type*)
+*/
+
+template<typename Element_type, typename Comp_func>
+void insert_sort(Element_type **first, Element_type **last, Comp_func comp)
+{
+ for (Element_type **high_water_mark= first+1;
+ high_water_mark < last;
+ high_water_mark++)
+ {
+ for (Element_type **cur= high_water_mark; cur > first ; cur--)
+ {
+ if (comp(*(cur-1), *cur))
+ break;
+
+ Element_type *tmp= *(cur-1);
+ *(cur-1)= *cur;
+ *cur= tmp;
+ }
+ }
+}
+
+
+/**
+ Sorts the elements in the range [first,last) into ascending order
+ using merge sort.
+
+ @param first First element in an array of pointers to be sorted
+ @param last Element after the last element in an array of pointers
+ to be sorted
+ @param comp Comparison function object that, taking two pointers
+ of the same type as those contained in the range,
+ returns true if the first argument goes before the
+ second argument in the specific strict weak ordering
+ it defines, and false otherwise.
+
+ In our case comp should be a function object with an operator:
+
+ bool operator()(Element_type*, Element_type*)
+*/
+
+template<typename Element_type, typename Comp_func>
+void merge_sort(Element_type **first, Element_type **last, Comp_func comp)
+{
+ const uint elements= last - first;
+
+ /*
+ Tests showed that the value 5 was a good number for JOIN_TAB
+ ordering, which is the primary use case for this function
+ */
+ if (elements < 5)
+ {
+ insert_sort(first, last, comp);
+ return;
+ }
+ Element_type **middle= first + (elements)/2;
+
+ merge_sort (first, middle, comp);
+ merge_sort (middle, last, comp);
+
+ std::queue<Element_type *> merged;
+
+ Element_type **cur1= first;
+ Element_type **cur2= middle;
+
+ for (uint i= 0; i < elements; i++)
+ {
+ DBUG_ASSERT (cur1 < middle || cur2 < last);
+
+ if (cur1 == middle)
+ merged.push(*cur2++);
+ else if (cur2 == last)
+ merged.push(*cur1++);
+ else if (comp(*cur1, *cur2))
+ merged.push(*cur1++);
+ else
+ merged.push(*cur2++);
+ }
+
+ Element_type **result= first;
+ while (!merged.empty())
+ {
+ *result++= merged.front();
+ merged.pop();
+ }
+}
+
+#endif /* MERGE_SORT_INCLUDED */
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2012-02-23 13:02:50 +0000
+++ b/sql/mysqld.cc 2012-02-23 18:36:17 +0000
@@ -588,6 +588,9 @@ uint mysql_real_data_home_len, mysql_dat
uint reg_ext_length;
const key_map key_map_empty(0);
key_map key_map_full(0); // Will be initialized later
+char logname_path[FN_REFLEN];
+char slow_logname_path[FN_REFLEN];
+char secure_file_real_path[FN_REFLEN];
DATE_TIME_FORMAT global_date_format, global_datetime_format, global_time_format;
Time_zone *default_tz;
@@ -1647,6 +1650,12 @@ void clean_up(bool print_message)
#endif
free_list(opt_plugin_load_list_ptr);
+ if (THR_THD)
+ (void) pthread_key_delete(THR_THD);
+
+ if (THR_MALLOC)
+ (void) pthread_key_delete(THR_MALLOC);
+
/*
The following lines may never be executed as the main thread may have
killed us
@@ -3224,7 +3233,6 @@ rpl_make_log_name(const char *opt,
int init_common_variables()
{
- char buff[FN_REFLEN];
umask(((~my_umask) & 0666));
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
tzset(); // Set tzname
@@ -3599,13 +3607,13 @@ int init_common_variables()
if (!VAR || !*VAR) \
{ \
my_free(VAR); /* it could be an allocated empty string "" */ \
- VAR= my_strdup(ALT, MYF(0)); \
+ VAR= ALT; \
}
FIX_LOG_VAR(opt_logname,
- make_default_log_name(buff, ".log"));
+ make_default_log_name(logname_path, ".log"));
FIX_LOG_VAR(opt_slow_logname,
- make_default_log_name(buff, "-slow.log"));
+ make_default_log_name(slow_logname_path, "-slow.log"));
#if defined(ENABLED_DEBUG_SYNC)
/* Initialize the debug sync facility. See debug_sync.cc. */
@@ -7062,6 +7070,7 @@ SHOW_VAR status_vars[]= {
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONGLONG_STATUS},
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONGLONG_STATUS},
+ {"Opt_partial_plans", (char*) offsetof(STATUS_VAR, opt_partial_plans), SHOW_LONGLONG_STATUS},
{"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC},
#ifdef HAVE_QUERY_CACHE
{"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_NOFLUSH},
@@ -7282,6 +7291,7 @@ static int mysql_init_variables(void)
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
opt_secure_auth= 0;
+ opt_secure_file_priv= NULL;
opt_bootstrap= opt_myisam_log= 0;
mqh_used= 0;
kill_in_progress= 0;
@@ -7356,7 +7366,12 @@ static int mysql_init_variables(void)
relay_log_info_file= (char*) "relay-log.info";
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
+ log_bin_basename= NULL;
+ log_bin_index= NULL;
+ /* Handler variables */
+ total_ha= 0;
+ total_ha_2pc= 0;
/* Variables in libraries */
charsets_dir= 0;
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
@@ -8227,10 +8242,7 @@ static int fix_paths(void)
if (opt_secure_file_priv)
{
if (*opt_secure_file_priv == 0)
- {
- my_free(opt_secure_file_priv);
- opt_secure_file_priv= 0;
- }
+ opt_secure_file_priv= NULL;
else
{
if (strlen(opt_secure_file_priv) >= FN_REFLEN)
@@ -8240,9 +8252,7 @@ static int fix_paths(void)
sql_print_warning("Failed to normalize the argument for --secure-file-priv.");
return 1;
}
- char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
convert_dirname(secure_file_real_path, buff, NullS);
- my_free(opt_secure_file_priv);
opt_secure_file_priv= secure_file_real_path;
}
}
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc 2011-10-02 08:25:38 +0000
+++ b/sql/rpl_handler.cc 2011-12-05 10:11:58 +0000
@@ -164,6 +164,8 @@ void delegates_destroy()
if (binlog_relay_io_delegate)
binlog_relay_io_delegate->~Binlog_relay_IO_delegate();
#endif /* HAVE_REPLICATION */
+ if (RPL_TRANS_BINLOG_INFO)
+ pthread_key_delete(RPL_TRANS_BINLOG_INFO);
}
/*
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2012-02-17 18:30:34 +0000
+++ b/sql/sql_class.cc 2012-02-22 08:57:27 +0000
@@ -2167,10 +2167,12 @@ bool select_result::check_simple_select(
}
-static String default_line_term("\n",default_charset_info);
-static String default_escaped("\\",default_charset_info);
-static String default_field_term("\t",default_charset_info);
-static String default_xml_row_term("<row>", default_charset_info);
+static const String default_line_term("\n",default_charset_info);
+static const String default_escaped("\\",default_charset_info);
+static const String default_field_term("\t",default_charset_info);
+static const String default_xml_row_term("<row>", default_charset_info);
+static const String my_empty_string("",default_charset_info);
+
sql_exchange::sql_exchange(char *name, bool flag,
enum enum_filetype filetype_arg)
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2012-02-23 13:02:50 +0000
+++ b/sql/sql_class.h 2012-02-23 18:36:17 +0000
@@ -837,6 +837,7 @@ typedef struct system_status_var
{
ulonglong created_tmp_disk_tables;
ulonglong created_tmp_tables;
+ ulonglong opt_partial_plans;
ulonglong ha_commit_count;
ulonglong ha_delete_count;
ulonglong ha_read_first_count;
@@ -3879,7 +3880,7 @@ class sql_exchange :public Sql_alloc
public:
enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
char *file_name;
- String *field_term,*enclosed,*line_term,*line_start,*escaped;
+ const String *field_term, *enclosed, *line_term, *line_start, *escaped;
bool opt_enclosed;
bool dumpfile;
ulong skip_lines;
=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc 2012-02-23 13:02:50 +0000
+++ b/sql/sql_executor.cc 2012-02-23 18:36:17 +0000
@@ -119,11 +119,6 @@ static bool setup_copy_fields(THD *thd,
Execute select, executor entry point.
@todo
- Note, that create_sort_index calls test_if_skip_sort_order and may
- finally replace sorting with index scan if there is a LIMIT clause in
- the query. It's never shown in EXPLAIN!
-
- @todo
When can we have here thd->net.report_error not zero?
*/
@@ -661,6 +656,9 @@ JOIN::execute(JOIN *parent)
Note: here we call make_cond_for_table() a second time in order
to get sort_table_cond. An alternative could be to use
Item::copy_andor_structure() to make a copy of sort_table_cond.
+
+ TODO: This is now obsolete as test_if_skip_sort_order()
+ is not any longer called as part of JOIN::execute() !
*/
if (curr_table->pre_idx_push_cond)
{
@@ -719,9 +717,6 @@ JOIN::execute(JOIN *parent)
Here we sort rows for ORDER BY/GROUP BY clause, if the optimiser
chose FILESORT to be faster than INDEX SCAN or there is no
suitable index present.
- Note, that create_sort_index calls test_if_skip_sort_order and may
- finally replace sorting with index scan if there is a LIMIT clause in
- the query. XXX: it's never shown in EXPLAIN!
OPTION_FOUND_ROWS supersedes LIMIT and is taken into account.
*/
DBUG_PRINT("info",("Sorting for order by/group by"));
@@ -908,7 +903,7 @@ JOIN::create_intermediate_table(List<Ite
DBUG_ASSERT(order);
explain_flags.set(order.src, ESP_USING_FILESORT);
}
- explain_flags.set(ESC_ORDER_BY, ESP_IS_SIMPLE);
+ explain_flags.set(order.src, ESP_IS_SIMPLE);
order= NULL;
}
}
@@ -1029,11 +1024,9 @@ JOIN::optimize_distinct()
/* Optimize "select distinct b from t1 order by key_part_1 limit #" */
if (order && skip_sort_order)
{
- /* Should always succeed */
- if (test_if_skip_sort_order(&join_tab[const_tables],
- order, unit->select_limit_cnt, false,
- &join_tab[const_tables].table->
- keys_in_use_for_order_by))
+ /* Should already have been optimized away */
+ DBUG_ASSERT(ordered_index_usage == ordered_index_order_by);
+ if (ordered_index_usage == ordered_index_order_by)
order= NULL;
}
}
@@ -3982,20 +3975,24 @@ create_sort_index(THD *thd, JOIN *join,
select= tab->select;
/*
- When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
- and thus force sorting on disk unless a group min-max optimization
- is going to be used as it is applied now only for one table queries
- with covering indexes.
+ JOIN::optimize may have prepared an access path which makes
+ either the GROUP BY or ORDER BY sorting obsolete by using an
+ ordered index for the access. If the requested 'order' match
+ the prepared 'ordered_index_usage', we don't have to build
+ a temporary sort index now.
*/
- if ((order != join->group_list ||
- !(join->select_options & SELECT_BIG_RESULT) ||
- (select && select->quick &&
- select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) &&
- test_if_skip_sort_order(tab,order,select_limit,0,
- is_order_by ? &table->keys_in_use_for_order_by :
- &table->keys_in_use_for_group_by))
- DBUG_RETURN(0);
+ {
+ DBUG_ASSERT((is_order_by) == (order == join->order)); // Obsolete arg !
+ const bool is_skippable= (is_order_by) ?
+ ( join->simple_order &&
+ join->ordered_index_usage == JOIN::ordered_index_order_by )
+ :
+ ( join->simple_group &&
+ join->ordered_index_usage == JOIN::ordered_index_group_by );
+ if (is_skippable)
+ DBUG_RETURN(0);
+ }
*filesorted= true;
if (dry_run)
=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h 2012-02-23 13:02:50 +0000
+++ b/sql/sql_list.h 2012-02-23 18:36:17 +0000
@@ -185,6 +185,14 @@ protected:
public:
uint elements;
+ bool operator==(const base_list &rhs) const
+ {
+ return
+ elements == rhs.elements &&
+ first == rhs.first &&
+ last == rhs.last;
+ }
+
inline void empty() { elements=0; first= &end_of_list; last=&first;}
inline base_list() { empty(); }
/**
@@ -526,17 +534,8 @@ public:
}
empty();
}
- /**
- @brief
- Sort the list according to provided comparison function
- @param cmp node comparison function
- @param arg additional info to be passed to comparison function
- * /
- inline void sort(Node_cmp_func cmp, void *arg)
- {
- base_list::sort(cmp, arg);
- }*/
+ using base_list::sort;
};
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2012-02-16 09:51:14 +0000
+++ b/sql/sql_load.cc 2012-02-22 08:57:27 +0000
@@ -67,7 +67,7 @@ class READ_INFO {
*end_of_buff; /* Data in bufferts ends here */
uint buff_length, /* Length of buffert */
max_length; /* Max length of row */
- char *field_term_ptr,*line_term_ptr,*line_start_ptr,*line_start_end;
+ const char *field_term_ptr, *line_term_ptr, *line_start_ptr, *line_start_end;
uint field_term_length,line_term_length,enclosed_length;
int field_term_char,line_term_char,enclosed_char,escape_char;
int *stack,*stack_pos;
@@ -84,14 +84,17 @@ public:
const CHARSET_INFO *read_charset;
READ_INFO(File file,uint tot_length,const CHARSET_INFO *cs,
- String &field_term,String &line_start,String &line_term,
- String &enclosed,int escape,bool get_it_from_net, bool is_fifo);
+ const String &field_term,
+ const String &line_start,
+ const String &line_term,
+ const String &enclosed,
+ int escape,bool get_it_from_net, bool is_fifo);
~READ_INFO();
int read_field();
int read_fixed_length(void);
int next_line(void);
char unescape(char chr);
- int terminator(char *ptr,uint length);
+ int terminator(const char *ptr,uint length);
bool find_start_of_fields();
/* load xml */
List<XML_TAG> taglist;
@@ -125,13 +128,13 @@ static int read_fixed_length(THD *thd, C
static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
- String &enclosed, ulong skip_lines,
+ const String &enclosed, ulong skip_lines,
bool ignore_check_option_errors);
static int read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
- String &enclosed, ulong skip_lines,
+ ulong skip_lines,
bool ignore_check_option_errors);
#ifndef EMBEDDED_LIBRARY
@@ -176,8 +179,9 @@ int mysql_load(THD *thd,sql_exchange *ex
File file;
TABLE *table= NULL;
int error= 0;
- String *field_term=ex->field_term,*escaped=ex->escaped;
- String *enclosed=ex->enclosed;
+ const String *field_term= ex->field_term;
+ const String *escaped= ex->escaped;
+ const String *enclosed= ex->enclosed;
bool is_fifo=0;
#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO lf_info;
@@ -493,7 +497,7 @@ int mysql_load(THD *thd,sql_exchange *ex
if (ex->filetype == FILETYPE_XML) /* load xml */
error= read_xml_field(thd, info, table_list, fields_vars,
set_fields, set_values, read_info,
- *(ex->line_term), skip_lines, ignore);
+ skip_lines, ignore);
else if (!field_term->length() && !enclosed->length())
error= read_fixed_length(thd, info, table_list, fields_vars,
set_fields, set_values, read_info,
@@ -922,7 +926,7 @@ static int
read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
- String &enclosed, ulong skip_lines,
+ const String &enclosed, ulong skip_lines,
bool ignore_check_option_errors)
{
List_iterator_fast<Item> it(fields_vars);
@@ -1134,7 +1138,7 @@ static int
read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
- String &row_tag, ulong skip_lines,
+ ulong skip_lines,
bool ignore_check_option_errors)
{
List_iterator_fast<Item> it(fields_vars);
@@ -1317,16 +1321,18 @@ READ_INFO::unescape(char chr)
READ_INFO::READ_INFO(File file_par, uint tot_length, const CHARSET_INFO *cs,
- String &field_term, String &line_start, String &line_term,
- String &enclosed_par, int escape, bool get_it_from_net,
- bool is_fifo)
+ const String &field_term,
+ const String &line_start,
+ const String &line_term,
+ const String &enclosed_par,
+ int escape, bool get_it_from_net, bool is_fifo)
:file(file_par), buff_length(tot_length), escape_char(escape),
found_end_of_line(false), eof(false), need_end_io_cache(false),
error(false), line_cuted(false), found_null(false), read_charset(cs)
{
- field_term_ptr=(char*) field_term.ptr();
+ field_term_ptr= field_term.ptr();
field_term_length= field_term.length();
- line_term_ptr=(char*) line_term.ptr();
+ line_term_ptr= line_term.ptr();
line_term_length= line_term.length();
level= 0; /* for load xml */
if (line_start.length() == 0)
@@ -1412,7 +1418,7 @@ READ_INFO::~READ_INFO()
#define PUSH(A) *(stack_pos++)=(A)
-inline int READ_INFO::terminator(char *ptr,uint length)
+inline int READ_INFO::terminator(const char *ptr,uint length)
{
int chr=0; // Keep gcc happy
uint i;
@@ -1732,7 +1738,7 @@ bool READ_INFO::find_start_of_fields()
return 1;
}
} while ((char) chr != line_start_ptr[0]);
- for (char *ptr=line_start_ptr+1 ; ptr != line_start_end ; ptr++)
+ for (const char *ptr=line_start_ptr+1 ; ptr != line_start_end ; ptr++)
{
chr=GET; // Eof will be checked later
if ((char) chr != *ptr)
=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc 2012-02-23 13:02:50 +0000
+++ b/sql/sql_optimizer.cc 2012-02-23 18:36:17 +0000
@@ -592,17 +592,23 @@ JOIN::optimize()
JOIN_TAB *tab= &join_tab[const_tables];
bool all_order_fields_used;
if (order)
- skip_sort_order= test_if_skip_sort_order(tab, order, m_select_limit, 1,
- &tab->table->keys_in_use_for_order_by);
+ {
+ skip_sort_order=
+ test_if_skip_sort_order(tab, order, m_select_limit,
+ true, // no_changes
+ &tab->table->keys_in_use_for_order_by);
+ }
ORDER *o;
if ((o= create_distinct_group(thd, ref_ptrs,
order, fields_list, all_fields,
&all_order_fields_used)))
{
group_list= ORDER_WITH_SRC(o, ESC_DISTINCT);
- bool skip_group= (skip_sort_order &&
- test_if_skip_sort_order(tab, group_list, m_select_limit, 1,
- &tab->table->keys_in_use_for_group_by) != 0);
+ const bool skip_group=
+ skip_sort_order &&
+ test_if_skip_sort_order(tab, group_list, m_select_limit,
+ true, // no_changes
+ &tab->table->keys_in_use_for_group_by);
count_field_types(select_lex, &tmp_table_param, all_fields, 0);
if ((skip_group && all_order_fields_used) ||
m_select_limit == HA_POS_ERROR ||
@@ -832,6 +838,26 @@ JOIN::optimize()
if (const_tables != tables)
{
+ JOIN_TAB *tab= &join_tab[const_tables];
+
+ if (order)
+ {
+ /*
+ Force using of tmp table if sorting by a SP or UDF function due to
+ their expensive and probably non-deterministic nature.
+ */
+ for (ORDER *tmp_order= order; tmp_order ; tmp_order=tmp_order->next)
+ {
+ Item *item= *tmp_order->item;
+ if (item->is_expensive())
+ {
+ /* Force tmp table without sort */
+ need_tmp=1; simple_order=simple_group=0;
+ break;
+ }
+ }
+ }
+
/*
Because filesort always does a full table scan or a quick range scan
we must add the removed reference to the select for the table.
@@ -839,52 +865,78 @@ JOIN::optimize()
as in other cases the join is done before the sort.
*/
if ((order || group_list) &&
- join_tab[const_tables].type != JT_ALL &&
- join_tab[const_tables].type != JT_FT &&
- join_tab[const_tables].type != JT_REF_OR_NULL &&
+ tab->type != JT_ALL &&
+ tab->type != JT_FT &&
+ tab->type != JT_REF_OR_NULL &&
((order && simple_order) || (group_list && simple_group)))
{
- if (add_ref_to_table_cond(thd,&join_tab[const_tables])) {
+ if (add_ref_to_table_cond(thd,tab)) {
DBUG_RETURN(1);
}
}
- if (!(select_options & SELECT_BIG_RESULT) &&
- ((group_list &&
- (!simple_group ||
- !test_if_skip_sort_order(&join_tab[const_tables], group_list,
- unit->select_limit_cnt, 0,
- &join_tab[const_tables].table->
- keys_in_use_for_group_by))) ||
- select_distinct) &&
- tmp_table_param.quick_group && !procedure)
- {
- need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort
- }
- if (order)
+ /*
+ Investigate whether we may use an ordered index as part of either
+ DISTINCT, GROUP BY or ORDER BY execution. An ordered index may be
+ used for only the first of any of these terms to be executed. This
+ is reflected in the order which we check for test_if_skip_sort_order()
+ below. However we do not check for DISTINCT here, as it would have
+ been transformed to a GROUP BY at this stage if it is a candidate for
+ ordered index optimization.
+ If a decision was made to use an ordered index, the availability
+ if such an access path is stored in 'ordered_index_usage' for later
+ use by 'execute' or 'explain'
+ */
+ DBUG_ASSERT(ordered_index_usage == ordered_index_void);
+
+ if (group_list) // GROUP BY honoured first
+ // (DISTINCT was rewritten to GROUP BY if skippable)
{
/*
- Do we need a temporary table due to the ORDER BY not being equal to
- the GROUP BY? The call to test_if_skip_sort_order above tests for the
- GROUP BY clause only and hence is not valid in this case. So the
- estimated number of rows to be read from the first table is not valid.
- We clear it here so that it doesn't show up in EXPLAIN.
- */
- if (need_tmp && (select_options & SELECT_DESCRIBE) != 0)
- join_tab[const_tables].limit= 0;
- /*
- Force using of tmp table if sorting by a SP or UDF function due to
- their expensive and probably non-deterministic nature.
+ When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
+ and thus force sorting on disk unless a group min-max optimization
+ is going to be used as it is applied now only for one table queries
+ with covering indexes.
*/
- for (ORDER *tmp_order= order; tmp_order ; tmp_order=tmp_order->next)
+ if (!(select_options & SELECT_BIG_RESULT) ||
+ (tab->select &&
+ tab->select->quick &&
+ tab->select->quick->get_type() ==
+ QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
{
- Item *item= *tmp_order->item;
- if (item->is_expensive())
+ if (simple_group && // GROUP BY is possibly skippable
+ !select_distinct) // .. if not preceded by a DISTINCT
{
- /* Force tmp table without sort */
- need_tmp=1; simple_order=simple_group=0;
- break;
+ /*
+ Calculate a possible 'limit' of table rows for 'GROUP BY':
+ A specified 'LIMIT' is relative to the final resultset.
+ 'need_tmp' implies that there will be more postprocessing
+ so the specified 'limit' should not be enforced yet.
+ */
+ const ha_rows limit = need_tmp ? HA_POS_ERROR : m_select_limit;
+
+ if (test_if_skip_sort_order(tab, group_list, limit, false,
+ &tab->table->keys_in_use_for_group_by))
+ {
+ ordered_index_usage= ordered_index_group_by;
+ }
}
+
+ if ((ordered_index_usage != ordered_index_group_by) &&
+ tmp_table_param.quick_group && !procedure)
+ {
+ need_tmp=1;
+ simple_order= simple_group= false; // Force tmp table without sort
+ }
+ }
+ }
+ else if (order && // ORDER BY wo/ preceeding GROUP BY
+ (simple_order || skip_sort_order)) // which is possibly skippable
+ {
+ if (test_if_skip_sort_order(tab, order, m_select_limit, false,
+ &tab->table->keys_in_use_for_order_by))
+ {
+ ordered_index_usage= ordered_index_order_by;
}
}
}
=== modified file 'sql/sql_optimizer.h'
--- a/sql/sql_optimizer.h 2012-02-23 13:02:50 +0000
+++ b/sql/sql_optimizer.h 2012-02-23 18:36:17 +0000
@@ -195,6 +195,19 @@ public:
GROUP/ORDER BY.
*/
bool simple_order, simple_group;
+
+ /*
+ ordered_index_usage is set if an ordered index access
+ should be used instead of a filesort when computing
+ ORDER/GROUP BY.
+ */
+ enum
+ {
+ ordered_index_void, // No ordered index avail.
+ ordered_index_group_by, // Use index for GROUP BY
+ ordered_index_order_by // Use index for ORDER BY
+ } ordered_index_usage;
+
/**
Is set only in case if we have a GROUP BY clause
and no ORDER BY after constant elimination of 'order'.
@@ -387,6 +400,7 @@ public:
no_order= 0;
simple_order= 0;
simple_group= 0;
+ ordered_index_usage= ordered_index_void;
skip_sort_order= 0;
need_tmp= 0;
hidden_group_fields= 0; /*safety*/
=== modified file 'sql/sql_planner.cc'
--- a/sql/sql_planner.cc 2012-01-16 12:51:06 +0000
+++ b/sql/sql_planner.cc 2012-02-23 11:22:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
#include "opt_range.h"
#include "opt_trace.h"
#include "sql_executor.h"
+#include "merge_sort.h"
#include <my_bit.h>
#include <algorithm>
@@ -37,106 +38,6 @@ using std::min;
static double prev_record_reads(JOIN *join, uint idx, table_map found_ref);
-/**
- Compare two JOIN_TAB objects based on the number of accessed records.
-
- @param ptr1 pointer to first JOIN_TAB object
- @param ptr2 pointer to second JOIN_TAB object
-
- NOTES
- The order relation implemented by join_tab_cmp() is not transitive,
- i.e. it is possible to choose such a, b and c that (a < b) && (b < c)
- but (c < a). This implies that result of a sort using the relation
- implemented by join_tab_cmp() depends on the order in which
- elements are compared, i.e. the result is implementation-specific.
- Example:
- a: dependent = 0x0 table->map = 0x1 found_records = 3 ptr = 0x907e6b0
- b: dependent = 0x0 table->map = 0x2 found_records = 3 ptr = 0x907e838
- c: dependent = 0x6 table->map = 0x10 found_records = 2 ptr = 0x907ecd0
-
- @retval
- 1 if first is bigger
- @retval
- -1 if second is bigger
- @retval
- 0 if equal
-*/
-
-static int
-join_tab_cmp(const void *, const void* ptr1, const void* ptr2)
-{
- JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
- JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
-
- if (jt1->dependent & jt2->table->map)
- return 1;
- if (jt2->dependent & jt1->table->map)
- return -1;
- if (jt1->found_records > jt2->found_records)
- return 1;
- if (jt1->found_records < jt2->found_records)
- return -1;
- return jt1 > jt2 ? 1 : (jt1 < jt2 ? -1 : 0);
-}
-
-
-/**
- Same as join_tab_cmp, but for use with SELECT_STRAIGHT_JOIN.
-*/
-
-static int
-join_tab_cmp_straight(const void *, const void* ptr1, const void* ptr2)
-{
- JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
- JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
-
- /*
- We don't do subquery flattening if the parent or child select has
- STRAIGHT_JOIN modifier. It is complicated to implement and the semantics
- is hardly useful.
- */
- DBUG_ASSERT(!jt1->emb_sj_nest);
- DBUG_ASSERT(!jt2->emb_sj_nest);
-
- if (jt1->dependent & jt2->table->map)
- return 1;
- if (jt2->dependent & jt1->table->map)
- return -1;
- return jt1 > jt2 ? 1 : (jt1 < jt2 ? -1 : 0);
-}
-
-
-/*
- Same as join_tab_cmp but tables from within the given semi-join nest go
- first. Used when optimizing semi-join materialization nests.
-*/
-
-static int
-join_tab_cmp_embedded_first(const void *emb, const void* ptr1, const void* ptr2)
-{
- const TABLE_LIST *emb_nest= (TABLE_LIST*) emb;
- JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
- JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
-
- if (jt1->emb_sj_nest == emb_nest && jt2->emb_sj_nest != emb_nest)
- return -1;
- if (jt1->emb_sj_nest != emb_nest && jt2->emb_sj_nest == emb_nest)
- return 1;
-
- if (jt1->dependent & jt2->table->map)
- return 1;
- if (jt2->dependent & jt1->table->map)
- return -1;
-
- if (jt1->found_records > jt2->found_records)
- return 1;
- if (jt1->found_records < jt2->found_records)
- return -1;
-
- return jt1 > jt2 ? 1 : (jt1 < jt2 ? -1 : 0);
-}
-
-
/*
This is a class for considering possible loose index scan optimizations.
It's usage pattern is as follows:
@@ -1149,7 +1050,6 @@ bool Optimize_table_order::choose_table_
}
reset_nj_counters(join->join_list);
- qsort2_cmp jtab_sort_func;
const bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
table_map join_tables; ///< The tables involved in order selection
@@ -1159,7 +1059,9 @@ bool Optimize_table_order::choose_table_
/* We're optimizing semi-join materialization nest, so put the
tables from this semi-join as first
*/
- jtab_sort_func= join_tab_cmp_embedded_first;
+ merge_sort(join->best_ref + join->const_tables,
+ join->best_ref + join->tables,
+ Join_tab_compare_embedded_first(emb_sjm_nest));
join_tables= emb_sjm_nest->sj_inner_tables;
}
else
@@ -1172,12 +1074,17 @@ bool Optimize_table_order::choose_table_
Apply heuristic: pre-sort all access plans with respect to the number of
records accessed.
*/
- jtab_sort_func= straight_join ? join_tab_cmp_straight : join_tab_cmp;
+ if (straight_join)
+ merge_sort(join->best_ref + join->const_tables,
+ join->best_ref + join->tables,
+ Join_tab_compare_straight());
+ else
+ merge_sort(join->best_ref + join->const_tables,
+ join->best_ref + join->tables,
+ Join_tab_compare_default());
+
join_tables= join->all_table_map & ~join->const_table_map;
}
- my_qsort2(join->best_ref + join->const_tables,
- join->tables - join->const_tables, sizeof(JOIN_TAB*),
- jtab_sort_func, (void*)emb_sjm_nest);
Opt_trace_object wrapper(&join->thd->opt_trace);
Opt_trace_array
@@ -1882,6 +1789,7 @@ bool Optimize_table_order::best_extensio
for (JOIN_TAB **pos= join->best_ref + idx; *pos; pos++)
{
+ status_var_increment(thd->status_var.opt_partial_plans);
JOIN_TAB *const s= *pos;
const table_map real_table_bit= s->table->map;
@@ -2250,6 +2158,7 @@ table_map Optimize_table_order::eq_ref_e
added_to_eq_ref_extension);
if (added_to_eq_ref_extension)
{
+ status_var_increment(thd->status_var.opt_partial_plans);
double current_record_count, current_read_time;
/* Add the cost of extending the plan with 's' */
=== modified file 'sql/sql_planner.h'
--- a/sql/sql_planner.h 2011-12-14 12:32:55 +0000
+++ b/sql/sql_planner.h 2012-02-23 11:22:34 +0000
@@ -1,7 +1,7 @@
#ifndef SQL_PLANNER_INCLUDED
#define SQL_PLANNER_INCLUDED
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -140,12 +140,6 @@ private:
double *newcount, double *newcost);
static uint determine_search_depth(uint search_depth, uint table_count);
- /**
- @todo: Add the static functions join_tab_cmp(), join_tab_cmp_straight() and
- join_tab_cmp_embedded_first() as static private member functions here.
- This is currently not possible because they are fed to my_qsort2(),
- which requires C linkage.
- */
};
void get_partial_join_cost(JOIN *join, uint n_tables, double *read_time_arg,
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2012-02-23 13:02:50 +0000
+++ b/sql/sql_select.cc 2012-02-23 18:36:17 +0000
@@ -701,6 +701,8 @@ static int clear_sj_tmp_tables(JOIN *joi
*/
void JOIN::restore_tmp()
{
+ DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
+ DBUG_ASSERT(tmp_join != this);
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
}
@@ -854,42 +856,6 @@ JOIN::explain()
DBUG_VOID_RETURN;
}
-
-
- {
- /*
- Update QEP with test_if_skip_sort_order() call if needed.
- */
- ORDER *local_order= order;
- bool local_simple_order= simple_order;
- bool local_skip_sort_order= skip_sort_order;
-
- /*
- Check if we managed to optimize ORDER BY away and don't use temporary
- table to resolve ORDER BY: in that case, we only may need to do
- filesort for GROUP BY.
- */
- if (!order && !no_order && (!skip_sort_order || !need_tmp))
- {
- /*
- Reset 'order' to 'group_list' and reinit variables describing
- 'order'
- */
- local_order= group_list;
- local_simple_order= simple_group;
- local_skip_sort_order= 0;
- }
- if (local_order &&
- (local_order != group_list || !(select_options & SELECT_BIG_RESULT)) &&
- const_tables != tables &&
- (local_simple_order || local_skip_sort_order))
- {
- test_if_skip_sort_order(&join_tab[const_tables], local_order,
- m_select_limit, 0,
- &join_tab[const_tables].table->
- keys_in_use_for_query);
- }
- }
having= tmp_having;
bool has_tmp_table1= exec_tmp_table1;
@@ -3174,13 +3140,18 @@ void JOIN::cleanup(bool full)
{
if (tmp_join)
tmp_table_param.copy_field= 0;
- group_fields.delete_elements();
+
/*
- Ensure that the above delete_elements() would not be called
+ Ensure that the following delete_elements() would not be called
twice for the same list.
*/
- if (tmp_join && tmp_join != this)
- tmp_join->group_fields= group_fields;
+ if (tmp_join && tmp_join != this &&
+ tmp_join->group_fields == this->group_fields)
+ tmp_join->group_fields.empty();
+
+ // Run Cached_item DTORs!
+ group_fields.delete_elements();
+
/*
We can't call delete_elements() on copy_funcs as this will cause
problems in free_elements() as some of the elements are then deleted.
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2012-02-18 16:05:11 +0000
+++ b/sql/sql_select.h 2012-02-23 18:36:17 +0000
@@ -1,7 +1,7 @@
#ifndef SQL_SELECT_INCLUDED
#define SQL_SELECT_INCLUDED
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
#include "sql_executor.h"
#include "opt_explain_format.h" // for Extra_tag
+#include <functional>
/**
Returns a constant of type 'type' with the 'A' lowest-weight bits set.
Example: LOWER_BITS(uint, 3) == 7.
@@ -655,6 +656,135 @@ st_join_table::st_join_table()
memset(&read_record, 0, sizeof(read_record));
}
+/**
+ "Less than" comparison function object used to compare two JOIN_TAB
+ objects based on a number of factors in this order:
+
+ - table before another table that depends on it (straight join,
+ outer join etc), then
+ - table before another table that depends on it to use a key
+ as access method, then
+ - table with smallest number of records first, then
+ - the table with lowest-value pointer (i.e., the one located
+ in the lowest memory address) first.
+
+ @param jt1 first JOIN_TAB object
+ @param jt2 second JOIN_TAB object
+
+ @note The order relation implemented by Join_tab_compare_default is not
+ transitive, i.e. it is possible to choose a, b and c such that
+ (a < b) && (b < c) but (c < a). This is the case in the
+ following example:
+
+ a: dependent = <none> found_records = 3
+ b: dependent = <none> found_records = 4
+ c: dependent = b found_records = 2
+
+ a < b: because a has fewer records
+ b < c: because c depends on b (e.g outer join dependency)
+ c < a: because c has fewer records
+
+ This implies that the result of a sort using the relation
+ implemented by Join_tab_compare_default () depends on the order in
+ which elements are compared, i.e. the result is
+ implementation-specific.
+
+ @return
+ true if jt1 is smaller than jt2, false otherwise
+*/
+class Join_tab_compare_default :
+ public std::binary_function<const JOIN_TAB*, const JOIN_TAB*, bool>
+{
+public:
+ bool operator()(const JOIN_TAB *jt1, const JOIN_TAB *jt2)
+ {
+ // Sorting distinct tables, so a table should not be compared with itself
+ DBUG_ASSERT(jt1 != jt2);
+
+ if (jt1->dependent & jt2->table->map)
+ return false;
+ if (jt2->dependent & jt1->table->map)
+ return true;
+
+ const bool jt1_keydep_jt2= jt1->key_dependent & jt2->table->map;
+ const bool jt2_keydep_jt1= jt2->key_dependent & jt1->table->map;
+
+ if (jt1_keydep_jt2 && !jt2_keydep_jt1)
+ return false;
+ if (jt2_keydep_jt1 && !jt1_keydep_jt2)
+ return true;
+
+ if (jt1->found_records > jt2->found_records)
+ return false;
+ if (jt1->found_records < jt2->found_records)
+ return true;
+
+ return jt1 < jt2;
+ }
+};
+
+/**
+ "Less than" comparison function object used to compare two JOIN_TAB
+ objects that are joined using STRAIGHT JOIN. For STRAIGHT JOINs,
+ the join order is dictated by the relative order of the tables in the
+ query which is reflected in JOIN_TAB::dependent. Table size and key
+ dependencies are ignored here.
+*/
+class Join_tab_compare_straight :
+ public std::binary_function<const JOIN_TAB*, const JOIN_TAB*, bool>
+{
+public:
+ bool operator()(const JOIN_TAB *jt1, const JOIN_TAB *jt2)
+ {
+ // Sorting distinct tables, so a table should not be compared with itself
+ DBUG_ASSERT(jt1 != jt2);
+
+ /*
+ We don't do subquery flattening if the parent or child select has
+ STRAIGHT_JOIN modifier. It is complicated to implement and the semantics
+ is hardly useful.
+ */
+ DBUG_ASSERT(!jt1->emb_sj_nest);
+ DBUG_ASSERT(!jt2->emb_sj_nest);
+
+ if (jt1->dependent & jt2->table->map)
+ return false;
+ if (jt2->dependent & jt1->table->map)
+ return true;
+
+ return jt1 < jt2;
+ }
+};
+
+/*
+ Same as Join_tab_compare_default but tables from within the given
+ semi-join nest go first. Used when optimizing semi-join
+ materialization nests.
+*/
+class Join_tab_compare_embedded_first :
+ public std::binary_function<const JOIN_TAB*, const JOIN_TAB*, bool>
+{
+private:
+ const TABLE_LIST *emb_nest;
+public:
+
+ Join_tab_compare_embedded_first(const TABLE_LIST *nest) : emb_nest(nest){}
+
+ bool operator()(const JOIN_TAB *jt1, const JOIN_TAB *jt2)
+ {
+ // Sorting distinct tables, so a table should not be compared with itself
+ DBUG_ASSERT(jt1 != jt2);
+
+ if (jt1->emb_sj_nest == emb_nest && jt2->emb_sj_nest != emb_nest)
+ return true;
+ if (jt1->emb_sj_nest != emb_nest && jt2->emb_sj_nest == emb_nest)
+ return false;
+
+ Join_tab_compare_default cmp;
+ return cmp(jt1,jt2);
+ }
+};
+
/**
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2012-02-16 10:57:29 +0000
+++ b/sql/sql_show.cc 2012-02-21 14:51:02 +0000
@@ -510,7 +510,10 @@ void
ignore_db_dirs_free()
{
if (opt_ignore_db_dirs)
+ {
my_free(opt_ignore_db_dirs);
+ opt_ignore_db_dirs= NULL;
+ }
ignore_db_dirs_reset();
delete_dynamic(&ignore_db_dirs_array);
my_hash_free(&ignore_db_dirs_hash);
=== modified file 'sql/sql_string.cc'
--- a/sql/sql_string.cc 2012-02-16 09:51:14 +0000
+++ b/sql/sql_string.cc 2012-02-22 08:57:27 +0000
@@ -539,7 +539,7 @@ bool String::append_with_prefill(const c
return FALSE;
}
-uint32 String::numchars()
+uint32 String::numchars() const
{
return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
}
=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h 2012-02-18 16:05:11 +0000
+++ b/sql/sql_string.h 2012-02-23 18:36:17 +0000
@@ -320,7 +320,7 @@ public:
friend int sortcmp(const String *a,const String *b, const CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
- uint32 numchars();
+ uint32 numchars() const;
int charpos(int i,uint32 offset=0);
int reserve(uint32 space_needed)
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-02-23 13:02:50 +0000
+++ b/sql/sys_vars.cc 2012-02-23 18:36:17 +0000
@@ -2355,7 +2355,7 @@ static Sys_var_charptr Sys_secure_file_p
"secure_file_priv",
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
"within specified directory",
- PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
+ READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
CMD_LINE(REQUIRED_ARG), IN_FS_CHARSET, DEFAULT(0));
static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type)
@@ -3353,7 +3353,7 @@ static bool fix_general_log_file(sys_var
}
static Sys_var_charptr Sys_general_log_path(
"general_log_file", "Log connections and queries to given file",
- PREALLOCATED GLOBAL_VAR(opt_logname), CMD_LINE(REQUIRED_ARG),
+ GLOBAL_VAR(opt_logname), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_log_path), ON_UPDATE(fix_general_log_file));
@@ -3371,7 +3371,7 @@ static Sys_var_charptr Sys_slow_log_path
"slow_query_log_file", "Log slow queries to given log file. "
"Defaults logging to hostname-slow.log. Must be enabled to activate "
"other slow log options",
- PREALLOCATED GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG),
+ GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file));
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2012-02-13 15:23:37 +0000
+++ b/tests/mysql_client_test.c 2012-02-21 14:51:02 +0000
@@ -58,6 +58,7 @@ static MYSQL *mysql= 0;
static char current_db[]= "client_test_db";
static unsigned int test_count= 0;
static unsigned int opt_count= 0;
+static unsigned int opt_count_read= 0;
static unsigned int iter_count= 0;
static my_bool have_innodb= FALSE;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
@@ -67,6 +68,9 @@ static const char *opt_vardir= "mysql-te
static longlong opt_getopt_ll_test= 0;
+static char **defaults_argv;
+static int original_argc;
+static char **original_argv;
static int embedded_server_arg_count= 0;
static char *embedded_server_args[MAX_SERVER_ARGS];
@@ -82,6 +86,11 @@ static double total_time;
const char *default_dbug_option= "d:t:o,/tmp/mysql_client_test.trace";
+/*
+ Read and parse arguments and MySQL options from my.cnf
+*/
+static const char *client_test_load_default_groups[]= { "client", 0 };
+
struct my_tests_st
{
const char *name;
@@ -110,6 +119,7 @@ if (!opt_silent) \
static void print_error(const char *msg);
static void print_st_error(MYSQL_STMT *stmt, const char *msg);
static void client_disconnect(MYSQL* mysql, my_bool drop_db);
+static void get_options(int *argc, char ***argv);
/*
@@ -268,7 +278,7 @@ static my_bool check_have_innodb(MYSQL *
MYSQL_RES *res;
MYSQL_ROW row;
int rc;
- my_bool result;
+ my_bool result= FALSE;
rc= mysql_query(conn,
"SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') "
@@ -280,7 +290,8 @@ static my_bool check_have_innodb(MYSQL *
row= mysql_fetch_row(res);
DIE_UNLESS(row);
- result= strcmp(row[1], "1") == 0;
+ if (row[0] && row[1])
+ result= strcmp(row[1], "1") == 0;
mysql_free_result(res);
return result;
}
@@ -8265,6 +8276,119 @@ static void test_set_option()
}
+#ifdef EMBEDDED_LIBRARY
+static void test_embedded_start_stop()
+{
+ MYSQL *mysql_emb=NULL;
+ int i, j;
+ int argc= original_argc; // Start with the original args
+ char **argv, **my_argv;
+ char test_name[]= "test_embedded_start_stop";
+#define EMBEDDED_RESTARTS 64
+
+ myheader("test_embedded_start_stop");
+
+ /* Must stop the main embedded server, since we use the same config. */
+ client_disconnect(mysql, 0); /* disconnect from server */
+ free_defaults(defaults_argv);
+ mysql_server_end();
+ /* Free everything allocated by my_once_alloc */
+ my_end(0);
+
+ /*
+ Use a copy of the original arguments.
+ The arguments will be altered when reading the configs and parsing
+ options.
+ */
+ my_argv= malloc((argc + 1) * sizeof(char*));
+ if (!my_argv)
+ exit(1);
+
+ /* Test restarting the embedded library many times. */
+ for (i= 1; i <= EMBEDDED_RESTARTS; i++)
+ {
+ argv= my_argv;
+ argv[0]= test_name;
+ for (j= 1; j < argc; j++)
+ argv[j]= original_argv[j];
+
+ /* Initialize everything again. */
+ MY_INIT(argv[0]);
+
+ /* Load the client defaults from the .cnf file[s]. */
+ if (load_defaults("my", client_test_load_default_groups, &argc, &argv))
+ {
+ myerror("load_defaults failed");
+ exit(1);
+ }
+
+ /* Parse the options (including the ones given from defaults files). */
+ get_options(&argc, &argv);
+
+ /* mysql_library_init is the same as mysql_server_init. */
+ if (mysql_library_init(embedded_server_arg_count,
+ embedded_server_args,
+ (char**) embedded_server_groups))
+ {
+ myerror("mysql_library_init failed");
+ exit(1);
+ }
+
+ /* Create a client connection. */
+ if (!(mysql_emb= mysql_client_init(NULL)))
+ {
+ myerror("mysql_client_init failed");
+ exit(1);
+ }
+
+ /* Connect it and see if we can use the database. */
+ if (!(mysql_real_connect(mysql_emb, opt_host, opt_user,
+ opt_password, current_db, 0,
+ NULL, 0)))
+ {
+ myerror("mysql_real_connect failed");
+ }
+
+ /* Close the client connection */
+ mysql_close(mysql_emb);
+ mysql_emb = NULL;
+ /* Free arguments allocated for defaults files. */
+ free_defaults(defaults_argv);
+ /* mysql_library_end is a define for mysql_server_end. */
+ mysql_library_end();
+ /* Free everything allocated by my_once_alloc */
+ my_end(0);
+ }
+
+ argc= original_argc;
+ argv= my_argv;
+ argv[0]= test_name;
+ for (j= 1; j < argc; j++)
+ argv[j]= original_argv[j];
+
+ MY_INIT(argv[0]);
+
+ if (load_defaults("my", client_test_load_default_groups, &argc, &argv))
+ {
+ myerror("load_defaults failed \n ");
+ exit(1);
+ }
+
+ get_options(&argc, &argv);
+
+ /* Must start the main embedded server again after the test. */
+ if (mysql_server_init(embedded_server_arg_count,
+ embedded_server_args,
+ (char**) embedded_server_groups))
+ DIE("Can't initialize MySQL server");
+
+ /* connect to server with no flags, default protocol, auto reconnect true */
+ mysql= client_connect(0, MYSQL_PROTOCOL_DEFAULT, 1);
+ free(my_argv);
+}
+#endif /* EMBEDDED_LIBRARY */
+
+
/*
Test a misc GRANT option
bug #89 (reported by mark@stripped)
@@ -20008,19 +20132,12 @@ static void test_bug13001491()
}
-/*
- Read and parse arguments and MySQL options from my.cnf
-*/
-
-static const char *client_test_load_default_groups[]= { "client", 0 };
-static char **defaults_argv;
-
static struct my_option client_test_long_options[] =
{
{"basedir", 'b', "Basedir for tests.", &opt_basedir,
&opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"count", 't', "Number of times test to be executed", &opt_count,
- &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"count", 't', "Number of times test to be executed", &opt_count_read,
+ &opt_count_read, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use", &opt_db, &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", &default_dbug_option,
@@ -20176,6 +20293,9 @@ static struct my_tests_st my_tests[]= {
{ "test_stiny_bug", test_stiny_bug },
{ "test_field_misc", test_field_misc },
{ "test_set_option", test_set_option },
+#ifdef EMBEDDED_LIBRARY
+ { "test_embedded_start_stop", test_embedded_start_stop },
+#endif
#ifndef EMBEDDED_LIBRARY
{ "test_prepare_grant", test_prepare_grant },
#endif
@@ -20434,6 +20554,11 @@ static void get_options(int *argc, char
{
int ho_error;
+ /* Copy argv from load_defaults, so we can free it when done. */
+ defaults_argv= *argv;
+ /* reset --silent option */
+ opt_silent= 0;
+
if ((ho_error= handle_options(argc, argv, client_test_long_options,
get_one_option)))
exit(ho_error);
@@ -20454,9 +20579,12 @@ static void print_test_output()
fprintf(stdout, "\n\n");
fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)",
test_count-1, opt_count);
- fprintf(stdout, "\n Total execution time: %g SECS", total_time);
- if (opt_count > 1)
- fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n Total execution time: %g SECS", total_time);
+ if (opt_count > 1)
+ fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
+ }
fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
}
@@ -20469,16 +20597,39 @@ static void print_test_output()
int main(int argc, char **argv)
{
+ int i;
+ char **tests_to_run= NULL, **curr_test;
struct my_tests_st *fptr;
MY_INIT(argv[0]);
+ /* Copy the original arguments, so it can be reused for restarting. */
+ original_argc= argc;
+ original_argv= malloc(argc * sizeof(char*));
+ if (argc && !original_argv)
+ exit(1);
+ for (i= 0; i < argc; i++)
+ original_argv[i]= strdup(argv[i]);
+
if (load_defaults("my", client_test_load_default_groups, &argc, &argv))
exit(1);
- defaults_argv= argv;
get_options(&argc, &argv);
+ /* Set main opt_count. */
+ opt_count= opt_count_read;
+
+ /* If there are any arguments left (named tests), save them. */
+ if (argc)
+ {
+ tests_to_run= malloc((argc + 1) * sizeof(char*));
+ if (!tests_to_run)
+ exit(1);
+ for (i= 0; i < argc; i++)
+ tests_to_run[i]= strdup(argv[i]);
+ tests_to_run[i]= NULL;
+ }
+
if (mysql_server_init(embedded_server_arg_count,
embedded_server_args,
(char**) embedded_server_groups))
@@ -20493,18 +20644,18 @@ int main(int argc, char **argv)
/* Start of tests */
test_count= 1;
start_time= time((time_t *)0);
- if (!argc)
+ if (!tests_to_run)
{
for (fptr= my_tests; fptr->name; fptr++)
(*fptr->function)();
}
else
{
- for ( ; *argv ; argv++)
+ for (curr_test= tests_to_run ; *curr_test ; curr_test++)
{
for (fptr= my_tests; fptr->name; fptr++)
{
- if (!strcmp(fptr->name, *argv))
+ if (!strcmp(fptr->name, *curr_test))
{
(*fptr->function)();
break;
@@ -20517,6 +20668,7 @@ int main(int argc, char **argv)
my_progname);
client_disconnect(mysql, 1);
free_defaults(defaults_argv);
+ mysql_server_end();
exit(1);
}
}
@@ -20540,5 +20692,17 @@ int main(int argc, char **argv)
my_end(0);
+ for (i= 0; i < original_argc; i++)
+ free(original_argv[i]);
+ if (original_argc)
+ free(original_argv);
+ if (tests_to_run)
+ {
+ for (curr_test= tests_to_run ; *curr_test ; curr_test++)
+ free(*curr_test);
+ free(tests_to_run);
+ }
+ my_free(opt_password);
+ my_free(opt_host);
exit(0);
}
=== modified file 'unittest/gunit/CMakeLists.txt'
--- a/unittest/gunit/CMakeLists.txt 2012-02-07 11:56:30 +0000
+++ b/unittest/gunit/CMakeLists.txt 2012-02-23 11:22:34 +0000
@@ -260,6 +260,7 @@ SET(SERVER_TESTS
sql_table
get_diagnostics
segfault
+ join_tab_sort
)
FOREACH(test ${TESTS})
=== added file 'unittest/gunit/join_tab_sort-t.cc'
--- a/unittest/gunit/join_tab_sort-t.cc 1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/join_tab_sort-t.cc 2012-02-23 11:22:34 +0000
@@ -0,0 +1,280 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+// First include (the generated) my_config.h, to get correct platform defines.
+#include "my_config.h"
+#include <gtest/gtest.h>
+
+#include "test_utils.h"
+
+#include "sql_select.h"
+#include "merge_sort.h"
+
+#include <vector>
+
+namespace {
+
+using my_testing::Server_initializer;
+using my_testing::Mock_error_handler;
+
+class JTSortTest : public ::testing::Test
+{
+protected:
+ static void SetUpTestCase()
+ {
+ Server_initializer::SetUpTestCase();
+ }
+
+ static void TearDownTestCase()
+ {
+ Server_initializer::TearDownTestCase();
+ }
+
+ virtual void SetUp()
+ {
+ initializer.SetUp();
+ }
+
+ virtual void TearDown()
+ {
+ initializer.TearDown();
+ }
+
+ Server_initializer initializer;
+};
+
+class MOCK_JOIN_TAB : public JOIN_TAB
+{
+public:
+ MOCK_JOIN_TAB(uint recs, uint table_no) : JOIN_TAB()
+ {
+ found_records= recs;
+ m_table.map= 1UL<<table_no;
+ this->table= &m_table;
+ }
+
+ TABLE m_table;
+};
+
+
+TEST_F(JTSortTest, SimpleSortTest)
+{
+ MOCK_JOIN_TAB jt1(UINT_MAX, 0);
+ MOCK_JOIN_TAB jt2(2, 0);
+ MOCK_JOIN_TAB jt3(1, 0);
+ MOCK_JOIN_TAB jt4(10, 0);
+ MOCK_JOIN_TAB jt5(5, 0);
+
+ MOCK_JOIN_TAB *arr[5];
+ arr[0]= &jt1;
+ arr[1]= &jt2;
+ arr[2]= &jt3;
+ arr[3]= &jt4;
+ arr[4]= &jt5;
+
+ insert_sort(arr, arr+5, Join_tab_compare_default());
+
+ EXPECT_EQ(1U, arr[0]->found_records);
+ EXPECT_EQ(2U, arr[1]->found_records);
+ EXPECT_EQ(5U, arr[2]->found_records);
+ EXPECT_EQ(10U, arr[3]->found_records);
+ EXPECT_EQ(UINT_MAX, arr[4]->found_records);
+
+}
+
+
+TEST_F(JTSortTest, SortFoundRecordsTest)
+{
+ const int num_tables= 50;
+ MOCK_JOIN_TAB *arr[num_tables];
+
+ for (int i= 0; i < num_tables; i++)
+ arr[i]= new MOCK_JOIN_TAB(i, 0);
+
+ // MERGE SORT
+ std::random_shuffle(arr, arr + 50);
+ merge_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records > arr[i-1]->found_records);
+
+ // INSERT SORT
+ std::random_shuffle(arr, arr + 50);
+ insert_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records > arr[i-1]->found_records);
+
+ for (int i= 0; i < num_tables; i++)
+ {
+ delete arr[i];
+ }
+}
+
+
+TEST_F(JTSortTest, SortDependsTest)
+{
+ const int num_tables= 50;
+ MOCK_JOIN_TAB *arr[num_tables];
+
+ /*
+ dependency has higher precedence than found_records, so the tables
+ shall be ordered with decreasing number of records in this test
+ */
+ for (int i= 0; i < num_tables; i++)
+ {
+ arr[i]= new MOCK_JOIN_TAB(i, i);
+ for (int j= i+1; j < num_tables; j++)
+ arr[i]->dependent|= 1UL << j;
+ }
+
+ // MERGE SORT
+ std::random_shuffle(arr, arr + num_tables);
+ merge_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records < arr[i-1]->found_records);
+
+ // INSERT SORT
+ std::random_shuffle(arr, arr + num_tables);
+ insert_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records < arr[i-1]->found_records);
+
+ for (int i= 0; i < num_tables; i++)
+ {
+ delete arr[i];
+ }
+}
+
+
+TEST_F(JTSortTest, SortKeyDependsTest)
+{
+ const int num_tables= 50;
+ MOCK_JOIN_TAB *arr[num_tables];
+
+ /*
+ key_dependency has higher precedence than found_records, so the
+ tables shall be ordered with decreasing number of records in this
+ test
+ */
+ for (int i= 0; i < num_tables; i++)
+ {
+ arr[i]= new MOCK_JOIN_TAB(i, i);
+ for (int j= i+1; j < num_tables; j++)
+ arr[i]->key_dependent|= 1UL << j;
+ }
+
+ // MERGE SORT
+ std::random_shuffle(arr, arr + num_tables);
+ merge_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records < arr[i-1]->found_records);
+
+ // INSERT SORT
+ std::random_shuffle(arr, arr + num_tables);
+ insert_sort(arr, arr + num_tables, Join_tab_compare_default());
+ for (int i= 1; i < num_tables; i++)
+ EXPECT_TRUE(arr[i]->found_records < arr[i-1]->found_records);
+
+ for (int i= 0; i < num_tables; i++)
+ delete arr[i];
+}
+
+/*
+ Above, sorting for JOIN_TABs were tested. Below we check that the
+ sorting works for ints types as well.
+*/
+
+class Int_compare_ptr :
+ public std::binary_function<const int*, const int*, bool>
+{
+public:
+ bool operator()(const int *i1, const int *i2) const
+ {
+ return *i1 < *i2;
+ }
+};
+
+
+TEST_F(JTSortTest, SortIntTest)
+{
+ const uint ints_to_sort= 1000;
+
+ std::vector<int> arr;
+ std::vector<int*> arr_ptr;
+
+ arr.reserve(ints_to_sort);
+ arr_ptr.reserve(ints_to_sort);
+
+ for (uint i= 0; i < ints_to_sort; i++)
+ {
+ arr.push_back(i);
+ arr_ptr.push_back(&arr[i]);
+ }
+
+ EXPECT_TRUE(arr.size() == ints_to_sort);
+ EXPECT_TRUE(arr_ptr.size() == ints_to_sort);
+
+ // MERGE SORT
+ std::random_shuffle(&arr_ptr.front(), &arr_ptr.back() + 1);
+ merge_sort(&arr_ptr.front(), &arr_ptr.back() + 1, Int_compare_ptr());
+ for (uint i= 0; i < arr_ptr.size(); i++)
+ EXPECT_TRUE(*arr_ptr[i] == (int)i);
+
+ // INSERT SORT
+ std::random_shuffle(&arr_ptr.front(), &arr_ptr.back() + 1);
+ insert_sort(&arr_ptr.front(), &arr_ptr.back() + 1, Int_compare_ptr());
+ for (uint i= 0; i < arr_ptr.size(); i++)
+ EXPECT_TRUE(*arr_ptr[i] == (int)i);
+}
+
+
+TEST_F(JTSortTest, SortInt2Test)
+{
+ const uint ints_to_sort= 1000;
+
+ std::vector<int> arr;
+ std::vector<int*> arr_ptr;
+
+ arr.reserve(ints_to_sort);
+ arr_ptr.reserve(ints_to_sort);
+
+ for (uint i= 0; i < (ints_to_sort - 2); i++)
+ {
+ arr.push_back((i % 2) ? i : (i * -1));
+ arr_ptr.push_back(&arr[i]);
+ }
+
+ arr.push_back(INT_MAX32);
+ arr_ptr.push_back(&arr.back());
+
+ arr.push_back(INT_MIN32);
+ arr_ptr.push_back(&arr.back());
+
+ EXPECT_TRUE(arr.size() == ints_to_sort);
+ EXPECT_TRUE(arr_ptr.size() == ints_to_sort);
+
+ // MERGE SORT
+ std::random_shuffle(&arr_ptr.front(), &arr_ptr.back() + 1);
+ merge_sort(&arr_ptr.front(), &arr_ptr.back() + 1, Int_compare_ptr());
+ for (uint i= 1; i < arr_ptr.size(); i++)
+ EXPECT_TRUE(*arr_ptr[i-1] < *arr_ptr[i]);
+
+ // INSERT SORT
+ std::random_shuffle(&arr_ptr.front(), &arr_ptr.back() + 1);
+ insert_sort(&arr_ptr.front(), &arr_ptr.back() + 1, Int_compare_ptr());
+ for (uint i= 1; i < arr_ptr.size(); i++)
+ EXPECT_TRUE(*arr_ptr[i-1] < *arr_ptr[i]);
+}
+
+}
=== modified file 'unittest/gunit/opt_range-t.cc'
--- a/unittest/gunit/opt_range-t.cc 2012-02-09 11:22:17 +0000
+++ b/unittest/gunit/opt_range-t.cc 2012-02-22 14:30:56 +0000
@@ -140,7 +140,13 @@ public:
if (item)
item->save_in_field_no_warnings(this, true);
}
-
+ ~Mock_field_long()
+ {
+ bitmap_free(&share_allset);
+ bitmap_free(&tbl_readset);
+ bitmap_free(&tbl_writeset);
+ }
+
// #bytes to store the value - see Field_long::key_lenght()
static const int KEY_LENGTH= 4;
const char *m_table_name;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (evgeny.potemkin:3550 to 3551) | Evgeny Potemkin | 24 Feb |