Commit 5b8777f4 authored by Igor Babaev's avatar Igor Babaev

Merge

parents 3b948d74 783ac7f3
......@@ -123,6 +123,7 @@ analyze table t1;
select count(*) from t1;
--replace_column 9 REF
--replace_result i2,i1 i1,i2
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
......@@ -130,6 +131,7 @@ select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
--replace_column 9 REF
--replace_result i3,i1 i1,i3
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
......
This diff is collapsed.
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
......@@ -1854,3 +1857,4 @@ set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
......@@ -1317,3 +1320,4 @@ set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch_jcl6;
This diff is collapsed.
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
......@@ -4790,3 +4793,4 @@ set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch_jcl6;
drop table if exists t0, t1, t2, t3, t4, t5, t11, t12, t21, t22;
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (oref int, grp int, ie int) ;
insert into t1 (oref, grp, ie) values
(1, 1, 1),
......@@ -1046,7 +1047,7 @@ select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) a
subq
NULL
0
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
......@@ -1107,7 +1108,7 @@ a
17
18
19
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
explain select * from (select a from t0) X where a in (select a from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
......@@ -1153,7 +1154,7 @@ show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 1
set @save_max_heap_table_size=@@max_heap_table_size;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
......@@ -1203,7 +1204,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer
drop table t1;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 as select * from t1;
......@@ -1285,7 +1286,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 eq_ref unique_key unique_key 10 func 1
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
set @@optimizer_search_depth=@save_optimizer_search_depth;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1, t2;
create table t0 (a decimal(4,2));
insert into t0 values (10.24), (22.11);
......@@ -1426,3 +1427,4 @@ CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 6
drop table if exists t0, t1, t2, t3, t4, t5, t11, t12, t21, t22;
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (oref int, grp int, ie int) ;
insert into t1 (oref, grp, ie) values
(1, 1, 1),
......@@ -1051,7 +1055,7 @@ select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) a
subq
NULL
0
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
......@@ -1112,7 +1116,7 @@ a
17
18
19
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
explain select * from (select a from t0) X where a in (select a from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
......@@ -1158,7 +1162,7 @@ show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 1
set @save_max_heap_table_size=@@max_heap_table_size;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
......@@ -1208,7 +1212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer
drop table t1;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 as select * from t1;
......@@ -1290,7 +1294,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 eq_ref unique_key unique_key 10 func 1
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
set @@optimizer_search_depth=@save_optimizer_search_depth;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1, t2;
create table t0 (a decimal(4,2));
insert into t0 values (10.24), (22.11);
......@@ -1431,7 +1435,9 @@ CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
set @@optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch;
drop table if exists t0, t1, t2, t3, t4, t10, t11, t12;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, b int);
......@@ -322,7 +323,8 @@ INSERT INTO WORKS VALUES ('E3','P2',20);
INSERT INTO WORKS VALUES ('E4','P2',20);
INSERT INTO WORKS VALUES ('E4','P4',40);
INSERT INTO WORKS VALUES ('E4','P5',80);
set optimizer_switch='default,materialization=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch='materialization=off';
explain SELECT EMPNUM, EMPNAME
FROM STAFF
WHERE EMPNUM IN
......@@ -344,7 +346,7 @@ E1 Alice
E2 Betty
E3 Carmen
E4 Don
set optimizer_switch='default';
set optimizer_switch=@save_optimizer_switch;
drop table STAFF,WORKS,PROJ;
# End of bug#45191
#
......@@ -450,7 +452,7 @@ COUNT(*)
drop table t1, t2;
drop view v1;
drop procedure p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
# End of bug#46744
Bug#46797 "Crash in fix_semijoin_strategies_for_picked_join_order
......@@ -601,7 +603,7 @@ v1field
DROP TABLE t1,t2;
DROP VIEW v1,v2;
DROP PROCEDURE p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
# End of BUG#48834
Bug#49097 subquery with view generates wrong result with
......@@ -1075,3 +1077,4 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
# End of Bug#48623
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
......@@ -733,3 +736,4 @@ set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 6
drop table if exists t0, t1, t2, t3, t4, t10, t11, t12;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, b int);
......@@ -326,7 +330,8 @@ INSERT INTO WORKS VALUES ('E3','P2',20);
INSERT INTO WORKS VALUES ('E4','P2',20);
INSERT INTO WORKS VALUES ('E4','P4',40);
INSERT INTO WORKS VALUES ('E4','P5',80);
set optimizer_switch='default,materialization=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch='materialization=off';
explain SELECT EMPNUM, EMPNAME
FROM STAFF
WHERE EMPNUM IN
......@@ -348,7 +353,7 @@ E1 Alice
E2 Betty
E3 Carmen
E4 Don
set optimizer_switch='default';
set optimizer_switch=@save_optimizer_switch;
drop table STAFF,WORKS,PROJ;
# End of bug#45191
#
......@@ -454,7 +459,7 @@ COUNT(*)
drop table t1, t2;
drop view v1;
drop procedure p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
# End of bug#46744
Bug#46797 "Crash in fix_semijoin_strategies_for_picked_join_order
......@@ -605,7 +610,7 @@ v1field
DROP TABLE t1,t2;
DROP VIEW v1,v2;
DROP PROCEDURE p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
# End of BUG#48834
Bug#49097 subquery with view generates wrong result with
......@@ -1079,6 +1084,7 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
# End of Bug#48623
set @@optimizer_switch=@save_optimizer_switch;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
#
......@@ -1114,3 +1120,4 @@ set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
join_cache_level 1
set @@optimizer_switch=@save_optimizer_switch_jcl6;
This diff is collapsed.
......@@ -2,6 +2,10 @@
# Run join_nested.test with BKA enabled
#
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -93,3 +97,5 @@ DROP TABLE t5,t6,t7,t8;
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch_jcl6;
......@@ -2,6 +2,10 @@
# Run join_outer.test with BKA enabled
#
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -9,3 +13,5 @@ show variables like 'join_cache_level';
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch_jcl6;
......@@ -2,6 +2,10 @@
# Run select.test with BKA enabled
#
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -9,3 +13,5 @@ show variables like 'join_cache_level';
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch_jcl6;
......@@ -2,6 +2,8 @@
drop table if exists t0, t1, t2, t3, t4, t5, t11, t12, t21, t22;
--enable_warnings
set @save_optimizer_switch=@@optimizer_switch;
#
# 1. Subquery with GROUP/HAVING
#
......@@ -888,7 +890,7 @@ set @@optimizer_switch='firstmatch=off';
explain
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t1;
......@@ -906,7 +908,7 @@ select * from t1 where 2 in (select a from t0);
set @@optimizer_switch='default,materialization=off';
explain select * from t1 where 2 in (select a from t0);
select * from t1 where 2 in (select a from t0);
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
#
......@@ -952,7 +954,7 @@ flush status;
select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E);
show status like 'Created_tmp_disk_tables';
set @save_max_heap_table_size=@@max_heap_table_size;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1;
#
......@@ -990,7 +992,7 @@ create table t1 (a decimal);
insert into t1 values (1),(2);
explain select * from t1 where a in (select a from t1);
drop table t1;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
#
# SJ-Materialization-scan for non-first table
......@@ -1051,7 +1053,7 @@ set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
explain select * from t1 where (a,b) in (select a,b from t2);
set @@optimizer_search_depth=@save_optimizer_search_depth;
set @@optimizer_switch=default;
set @@optimizer_switch=@save_optimizer_switch;
drop table t0, t1, t2;
......@@ -1181,3 +1183,6 @@ ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
CALL p1;
DROP PROCEDURE p1;
DROP TABLE t1, t2;
# The following command must be the last one the file
set @@optimizer_switch=@save_optimizer_switch;
......@@ -2,6 +2,10 @@
# Run subselect3.test with BKA enabled
#
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -9,3 +13,5 @@ show variables like 'join_cache_level';
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch;
......@@ -5,6 +5,8 @@
drop table if exists t0, t1, t2, t3, t4, t10, t11, t12;
--enable_warnings
set @save_optimizer_switch=@@optimizer_switch;
#
# 1. Subqueries that are converted into semi-joins
#
......@@ -224,7 +226,8 @@ INSERT INTO WORKS VALUES ('E4','P2',20);
INSERT INTO WORKS VALUES ('E4','P4',40);
INSERT INTO WORKS VALUES ('E4','P5',80);
set optimizer_switch='default,materialization=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch='materialization=off';
explain SELECT EMPNUM, EMPNAME
FROM STAFF
......@@ -240,7 +243,7 @@ WHERE EMPNUM IN
WHERE PNUM IN
(SELECT PNUM FROM PROJ));
set optimizer_switch='default';
set optimizer_switch=@save_optimizer_switch;
drop table STAFF,WORKS,PROJ;
......@@ -359,7 +362,7 @@ drop table t1, t2;
drop view v1;
drop procedure p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
--echo # End of bug#46744
......@@ -526,7 +529,7 @@ DROP TABLE t1,t2;
DROP VIEW v1,v2;
DROP PROCEDURE p1;
set SESSION optimizer_switch='default';
set SESSION optimizer_switch=@save_optimizer_switch;
--echo # End of BUG#48834
......@@ -935,3 +938,6 @@ DROP TABLE t2;
DROP TABLE t3;
--echo # End of Bug#48623
# The following command must be the last one the file
set @@optimizer_switch=@save_optimizer_switch;
......@@ -2,6 +2,10 @@
# Run subselect_sj2.test with BKA enabled
#
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -9,3 +13,6 @@ show variables like 'join_cache_level';
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch_jcl6;
......@@ -2,6 +2,10 @@
# Run subselect_sj.test with BKA enabled
#
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set join_cache_level=6;
show variables like 'join_cache_level';
......@@ -37,3 +41,5 @@ drop table t0, t1, t2;
set join_cache_level=default;
show variables like 'join_cache_level';
set @@optimizer_switch=@save_optimizer_switch_jcl6;
......@@ -1211,6 +1211,8 @@ typedef struct st_range_seq_if
bool (*skip_index_tuple) (range_seq_t seq, char *range_info);
} RANGE_SEQ_IF;
typedef bool (*SKIP_INDEX_TUPLE_FUNC) (range_seq_t seq, char *range_info);
class COST_VECT
{
public:
......
......@@ -571,12 +571,17 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE 512
#define OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN 1024
#define OPTIMIZER_SWITCH_SUBQUERY_CACHE (1<<11)
#define OPTIMIZER_SWITCH_OUTER_JOIN_WITH_CACHE (1<<12)
#define OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE (1<<13)
#define OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL (1<<14)
#define OPTIMIZER_SWITCH_JOIN_CACHE_HASHED (1<<15)
#define OPTIMIZER_SWITCH_JOIN_CACHE_BKA (1<<16)
#ifdef DBUG_OFF
# define OPTIMIZER_SWITCH_LAST (1<<12)
# define OPTIMIZER_SWITCH_LAST (1<<17)
#else
# define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1<<12)
# define OPTIMIZER_SWITCH_LAST (1<<13)
# define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1<<17)
# define OPTIMIZER_SWITCH_LAST (1<<18)
#endif
#ifdef DBUG_OFF
......@@ -592,7 +597,10 @@ class Default_object_creation_ctx : public Object_creation_ctx
OPTIMIZER_SWITCH_SEMIJOIN | \
OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\
OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\
OPTIMIZER_SWITCH_SUBQUERY_CACHE)
OPTIMIZER_SWITCH_SUBQUERY_CACHE | \
OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL | \
OPTIMIZER_SWITCH_JOIN_CACHE_HASHED | \
OPTIMIZER_SWITCH_JOIN_CACHE_BKA)
#else
# define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
......@@ -606,7 +614,10 @@ class Default_object_creation_ctx : public Object_creation_ctx
OPTIMIZER_SWITCH_SEMIJOIN | \
OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\
OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\
OPTIMIZER_SWITCH_SUBQUERY_CACHE)
OPTIMIZER_SWITCH_SUBQUERY_CACHE | \
OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL | \
OPTIMIZER_SWITCH_JOIN_CACHE_HASHED | \
OPTIMIZER_SWITCH_JOIN_CACHE_BKA)
#endif
/*
......
......@@ -308,6 +308,11 @@ static const char *optimizer_switch_names[]=
"partial_match_rowid_merge",
"partial_match_table_scan",
"subquery_cache",
"outer_join_with_cache",
"semijoin_with_cache",
"join_cache_incremental",
"join_cache_hashed",
"join_cache_bka",
#ifndef DBUG_OFF
"table_elimination",
#endif
......@@ -329,6 +334,11 @@ static const unsigned int optimizer_switch_names_len[]=
sizeof("partial_match_rowid_merge") - 1,
sizeof("partial_match_table_scan") - 1,
sizeof("subquery_cache") - 1,
sizeof("outer_join_with_cache") - 1,
sizeof("semijoin_with_cache") - 1,
sizeof("join_cache_incremental") - 1,
sizeof("join_cache_hashed") - 1,
sizeof("join_cache_bka") - 1,
#ifndef DBUG_OFF
sizeof("table_elimination") - 1,
#endif
......@@ -415,7 +425,10 @@ static const char *optimizer_switch_str="index_merge=on,index_merge_union=on,"
"semijoin=on,"
"partial_match_rowid_merge=on,"
"partial_match_table_scan=on,"
"subquery_cache=on"
"subquery_cache=on,"
"join_cache_incremental=on,"
"join_cache_hashed=on,"
"join_cache_bka=on"
#ifndef DBUG_OFF
",table_elimination=on";
#else
......@@ -5865,7 +5878,8 @@ enum options_mysqld
OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE,
OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, OPT_FT_BOOLEAN_SYNTAX,
OPT_FT_MAX_WORD_LEN, OPT_FT_QUERY_EXPANSION_LIMIT, OPT_FT_STOPWORD_FILE,
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, OPT_JOIN_CACHE_LEVEL,
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
OPT_JOIN_BUFF_SPACE_LIMIT, OPT_JOIN_CACHE_LEVEL,
OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
OPT_KEY_CACHE_PARTITIONS,
......@@ -6958,11 +6972,17 @@ log and this option does nothing anymore.",
(uchar**) &max_system_variables.net_interactive_timeout, 0,
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"join_buffer_size", OPT_JOIN_BUFF_SIZE,
"The size of the buffer that is used for full joins.",
"The size of the buffer that is used for joins.",
(uchar**) &global_system_variables.join_buff_size,
(uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, 128+MALLOC_OVERHEAD, (longlong) ULONG_MAX,
MALLOC_OVERHEAD, 128, 0},
{"join_buffer_space_limit", OPT_JOIN_BUFF_SPACE_LIMIT,
"The limit of the space for all join buffers used by a query.",
(uchar**) &global_system_variables.join_buff_space_limit,
(uchar**) &max_system_variables.join_buff_space_limit, 0, GET_ULL,
REQUIRED_ARG, 8*128*1024L, 2048+MALLOC_OVERHEAD, (longlong) ULONGLONG_MAX,
MALLOC_OVERHEAD, 2048, 0},
{"join_cache_level", OPT_JOIN_CACHE_LEVEL,
"Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers",
(uchar**) &global_system_variables.join_cache_level,
......@@ -7235,7 +7255,8 @@ The minimum value for this variable is 4096.",
"index_merge_union, index_merge_sort_union, index_merge_intersection, "
"index_condition_pushdown, firstmatch, loosescan, materialization, "
"semijoin, partial_match_rowid_merge, partial_match_table_scan, "
"subquery_cache"
"subquery_cache, outer_join_with_cache, semijoin_with_cache, "
"join_cache_incremental, join_cache_hashed, join_cache_bka"
#ifndef DBUG_OFF
", table_elimination"
#endif
......
......@@ -199,7 +199,8 @@ class Loose_scan_opt
double records= rows2double(s->table->file->stats.records);
/* The cost is entire index scan cost (divided by 2) */
double read_time= s->table->file->keyread_read_time(key, 1, records);
double read_time=
s->table->file->keyread_read_time(key, 1, (ha_rows) records);
/*
Now find out how many different keys we will get (for now we
......
......@@ -319,6 +319,9 @@ static sys_var_thd_ulong sys_interactive_timeout(&vars, "interactive_timeout",
&SV::net_interactive_timeout);
static sys_var_thd_ulong sys_join_buffer_size(&vars, "join_buffer_size",
&SV::join_buff_size);
static sys_var_thd_ulonglong sys_join_buffer_space_limit(&vars,
"join_buffer_space_limit",
&SV::join_buff_space_limit);
static sys_var_thd_ulong sys_join_cache_level(&vars, "join_cache_level",
&SV::join_cache_level);
static sys_var_key_buffer_size sys_key_buffer_size(&vars, "key_buffer_size");
......@@ -4045,7 +4048,7 @@ bool
sys_var_thd_optimizer_switch::
symbolic_mode_representation(THD *thd, ulonglong val, LEX_STRING *rep)
{
char buff[STRING_BUFFER_USUAL_SIZE*8];
char buff[STRING_BUFFER_USUAL_SIZE*18];
String tmp(buff, sizeof(buff), &my_charset_latin1);
int i;
ulonglong bit;
......
......@@ -376,6 +376,7 @@ struct system_variables
ulonglong max_heap_table_size;
ulonglong tmp_table_size;
ulonglong long_query_time;
ulonglong join_buff_space_limit;
ha_rows select_limit;
ha_rows max_join_size;
ulong auto_increment_increment, auto_increment_offset;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6458,6 +6458,7 @@ ha_innobase::info(
}
stats.check_time = 0;
stats.mrr_length_per_rec= ref_length + 8; // 8 = max(sizeof(void *));
if (stats.records == 0) {
stats.mean_rec_length = 0;
......
......@@ -7534,6 +7534,8 @@ ha_innobase::info(
}
stats.check_time = 0;
stats.mrr_length_per_rec= ref_length + 8; // 8 = max(sizeof(void *));
if (stats.records == 0) {
stats.mean_rec_length = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment