mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
@@in_predicate_conversion_threshold
* rename in_subquery_conversion_threshold to in_predicate_conversion_threshold * make it debug-only, hide from users * change from ulong to uint - same type and range on all architectures
This commit is contained in:
@ -336,10 +336,6 @@ The following options may be given as the first argument:
|
|||||||
Specifies a directory to add to the ignore list when
|
Specifies a directory to add to the ignore list when
|
||||||
collecting database names from the datadir. Put a blank
|
collecting database names from the datadir. Put a blank
|
||||||
argument to reset the list accumulated so far.
|
argument to reset the list accumulated so far.
|
||||||
--in-subquery-conversion-threshold[=#]
|
|
||||||
The minimum number of scalar elements in the value list
|
|
||||||
of IN predicate that triggers its conversion to IN
|
|
||||||
subquery
|
|
||||||
--init-connect=name Command(s) that are executed for each new connection
|
--init-connect=name Command(s) that are executed for each new connection
|
||||||
(unless the user has SUPER privilege)
|
(unless the user has SUPER privilege)
|
||||||
--init-file=name Read SQL commands from this file at startup
|
--init-file=name Read SQL commands from this file at startup
|
||||||
@ -1415,7 +1411,6 @@ idle-transaction-timeout 0
|
|||||||
idle-write-transaction-timeout 0
|
idle-write-transaction-timeout 0
|
||||||
ignore-builtin-innodb FALSE
|
ignore-builtin-innodb FALSE
|
||||||
ignore-db-dirs
|
ignore-db-dirs
|
||||||
in-subquery-conversion-threshold 1000
|
|
||||||
init-connect
|
init-connect
|
||||||
init-file (No default value)
|
init-file (No default value)
|
||||||
init-rpl-role MASTER
|
init-rpl-role MASTER
|
||||||
|
@ -27,7 +27,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` in (1,2)
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` in (1,2)
|
||||||
# set minimum number of values in VALUEs list when optimization works to 2
|
# set minimum number of values in VALUEs list when optimization works to 2
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
# single IN-predicate in WHERE-part
|
# single IN-predicate in WHERE-part
|
||||||
select * from t1 where a in (1,2);
|
select * from t1 where a in (1,2);
|
||||||
a b
|
a b
|
||||||
@ -485,7 +485,7 @@ a b
|
|||||||
2 5
|
2 5
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
# use inside out access from tvc rows
|
# use inside out access from tvc rows
|
||||||
set @@in_subquery_conversion_threshold= default;
|
set @@in_predicate_conversion_threshold= default;
|
||||||
select * from t3 where a in (1,4,10);
|
select * from t3 where a in (1,4,10);
|
||||||
a b
|
a b
|
||||||
1 abc
|
1 abc
|
||||||
@ -498,7 +498,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE t3 range idx idx 5 NULL 5 100.00 Using index condition
|
1 SIMPLE t3 range idx idx 5 NULL 5 100.00 Using index condition
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` where `test`.`t3`.`a` in (1,4,10)
|
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` where `test`.`t3`.`a` in (1,4,10)
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
select * from t3 where a in (1,4,10);
|
select * from t3 where a in (1,4,10);
|
||||||
a b
|
a b
|
||||||
1 abc
|
1 abc
|
||||||
@ -515,7 +515,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` semi join ((values (1),(4),(10)) `tvc_0`) where `test`.`t3`.`a` = `tvc_0`.`1`
|
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` semi join ((values (1),(4),(10)) `tvc_0`) where `test`.`t3`.`a` = `tvc_0`.`1`
|
||||||
# use vectors in IN predeicate
|
# use vectors in IN predeicate
|
||||||
set @@in_subquery_conversion_threshold= 4;
|
set @@in_predicate_conversion_threshold= 4;
|
||||||
select * from t1 where (a,b) in ((1,2),(3,4));
|
select * from t1 where (a,b) in ((1,2),(3,4));
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
@ -527,9 +527,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1,2),(3,4)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` and `test`.`t1`.`b` = `tvc_0`.`2`
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1,2),(3,4)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` and `test`.`t1`.`b` = `tvc_0`.`2`
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
# trasformation works for the one IN predicate and doesn't work for the other
|
# trasformation works for the one IN predicate and doesn't work for the other
|
||||||
set @@in_subquery_conversion_threshold= 5;
|
set @@in_predicate_conversion_threshold= 5;
|
||||||
select * from t2
|
select * from t2
|
||||||
where (a,b) in ((1,2),(8,9)) and
|
where (a,b) in ((1,2),(8,9)) and
|
||||||
(a,c) in ((1,3),(8,0),(5,1));
|
(a,c) in ((1,3),(8,0),(5,1));
|
||||||
@ -546,7 +546,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` semi join ((values (1,3),(8,0),(5,1)) `tvc_0`) where `test`.`t2`.`a` = `tvc_0`.`1` and `test`.`t2`.`c` = `tvc_0`.`3` and (`tvc_0`.`1`,`test`.`t2`.`b`) in (<cache>((1,2)),<cache>((8,9)))
|
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` semi join ((values (1,3),(8,0),(5,1)) `tvc_0`) where `test`.`t2`.`a` = `tvc_0`.`1` and `test`.`t2`.`c` = `tvc_0`.`3` and (`tvc_0`.`1`,`test`.`t2`.`b`) in (<cache>((1,2)),<cache>((8,9)))
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
#
|
#
|
||||||
# mdev-14281: conversion of NOT IN predicate into subquery predicate
|
# mdev-14281: conversion of NOT IN predicate into subquery predicate
|
||||||
#
|
#
|
||||||
@ -613,4 +613,4 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( <materialize> (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`1` and `test`.`t2`.`c` = `<subquery2>`.`2`))))
|
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( <materialize> (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`1` and `test`.`t2`.`c` = `<subquery2>`.`2`))))
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
set @@in_subquery_conversion_threshold= default;
|
set @@in_predicate_conversion_threshold= default;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
set in_subquery_conversion_threshold=10000;
|
|
||||||
drop table if exists t1, t2, t3, t10, t100;
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
event_date date DEFAULT '0000-00-00' NOT NULL,
|
event_date date DEFAULT '0000-00-00' NOT NULL,
|
||||||
type int(11) DEFAULT '0' NOT NULL,
|
type int(11) DEFAULT '0' NOT NULL,
|
||||||
@ -1064,7 +1062,9 @@ set @b= concat("explain ", @a);
|
|||||||
prepare stmt1 from @b;
|
prepare stmt1 from @b;
|
||||||
execute stmt1;
|
execute stmt1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 index a a 5 NULL 1003 Using where; Using index
|
1 PRIMARY t2 index NULL a 5 NULL 1003 Using where; Using index
|
||||||
|
2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
prepare stmt1 from @a;
|
prepare stmt1 from @a;
|
||||||
execute stmt1;
|
execute stmt1;
|
||||||
a
|
a
|
||||||
@ -3007,4 +3007,3 @@ drop table t1,t2,t3;
|
|||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
set in_subquery_conversion_threshold=default;
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
set @mrr_icp_extra_tmp=@@optimizer_switch;
|
set @mrr_icp_extra_tmp=@@optimizer_switch;
|
||||||
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
|
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
|
||||||
set in_subquery_conversion_threshold=10000;
|
|
||||||
drop table if exists t1, t2, t3, t10, t100;
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
event_date date DEFAULT '0000-00-00' NOT NULL,
|
event_date date DEFAULT '0000-00-00' NOT NULL,
|
||||||
type int(11) DEFAULT '0' NOT NULL,
|
type int(11) DEFAULT '0' NOT NULL,
|
||||||
@ -1066,7 +1064,9 @@ set @b= concat("explain ", @a);
|
|||||||
prepare stmt1 from @b;
|
prepare stmt1 from @b;
|
||||||
execute stmt1;
|
execute stmt1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 index a a 5 NULL 1003 Using where; Using index
|
1 PRIMARY t2 index NULL a 5 NULL 1003 Using where; Using index
|
||||||
|
2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
prepare stmt1 from @a;
|
prepare stmt1 from @a;
|
||||||
execute stmt1;
|
execute stmt1;
|
||||||
a
|
a
|
||||||
@ -3019,5 +3019,4 @@ drop table t1,t2,t3;
|
|||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
set in_subquery_conversion_threshold=default;
|
|
||||||
set optimizer_switch=@mrr_icp_extra_tmp;
|
set optimizer_switch=@mrr_icp_extra_tmp;
|
||||||
|
@ -19,6 +19,7 @@ select * from information_schema.system_variables
|
|||||||
variable_name not like 'debug%' and
|
variable_name not like 'debug%' and
|
||||||
variable_name not like 'wsrep%' and
|
variable_name not like 'wsrep%' and
|
||||||
variable_name not in (
|
variable_name not in (
|
||||||
|
'in_predicate_conversion_threshold',
|
||||||
'have_openssl',
|
'have_openssl',
|
||||||
'have_symlink',
|
'have_symlink',
|
||||||
'hostname',
|
'hostname',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
select * from information_schema.system_variables
|
select * from information_schema.system_variables
|
||||||
where variable_name like 'debug%'
|
where variable_name like 'debug%'
|
||||||
|
or variable_name = 'in_predicate_conversion_threshold'
|
||||||
order by variable_name;
|
order by variable_name;
|
||||||
VARIABLE_NAME DEBUG
|
VARIABLE_NAME DEBUG
|
||||||
SESSION_VALUE
|
SESSION_VALUE
|
||||||
@ -85,3 +86,17 @@ NUMERIC_BLOCK_SIZE NULL
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY NO
|
READ_ONLY NO
|
||||||
COMMAND_LINE_ARGUMENT NULL
|
COMMAND_LINE_ARGUMENT NULL
|
||||||
|
VARIABLE_NAME IN_PREDICATE_CONVERSION_THRESHOLD
|
||||||
|
SESSION_VALUE 1000
|
||||||
|
GLOBAL_VALUE 1000
|
||||||
|
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||||
|
DEFAULT_VALUE 1000
|
||||||
|
VARIABLE_SCOPE SESSION
|
||||||
|
VARIABLE_TYPE INT UNSIGNED
|
||||||
|
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery
|
||||||
|
NUMERIC_MIN_VALUE 0
|
||||||
|
NUMERIC_MAX_VALUE 4294967295
|
||||||
|
NUMERIC_BLOCK_SIZE 1
|
||||||
|
ENUM_VALUE_LIST NULL
|
||||||
|
READ_ONLY NO
|
||||||
|
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||||
|
@ -1439,20 +1439,6 @@ NUMERIC_BLOCK_SIZE 1
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY NO
|
READ_ONLY NO
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
VARIABLE_NAME IN_SUBQUERY_CONVERSION_THRESHOLD
|
|
||||||
SESSION_VALUE 1000
|
|
||||||
GLOBAL_VALUE 1000
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 1000
|
|
||||||
VARIABLE_SCOPE SESSION
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
|
||||||
VARIABLE_NAME IN_TRANSACTION
|
VARIABLE_NAME IN_TRANSACTION
|
||||||
SESSION_VALUE 0
|
SESSION_VALUE 0
|
||||||
GLOBAL_VALUE NULL
|
GLOBAL_VALUE NULL
|
||||||
|
@ -8,6 +8,7 @@ where variable_name not like 'aria%' and
|
|||||||
variable_name not like 'debug%' and
|
variable_name not like 'debug%' and
|
||||||
variable_name not like 'wsrep%' and
|
variable_name not like 'wsrep%' and
|
||||||
variable_name not in (
|
variable_name not in (
|
||||||
|
'in_predicate_conversion_threshold',
|
||||||
'have_openssl',
|
'have_openssl',
|
||||||
'have_symlink',
|
'have_symlink',
|
||||||
'hostname',
|
'hostname',
|
||||||
@ -1565,20 +1566,6 @@ NUMERIC_BLOCK_SIZE 1
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY NO
|
READ_ONLY NO
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
VARIABLE_NAME IN_SUBQUERY_CONVERSION_THRESHOLD
|
|
||||||
SESSION_VALUE 1000
|
|
||||||
GLOBAL_VALUE 1000
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 1000
|
|
||||||
VARIABLE_SCOPE SESSION
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
|
||||||
VARIABLE_NAME IN_TRANSACTION
|
VARIABLE_NAME IN_TRANSACTION
|
||||||
SESSION_VALUE 0
|
SESSION_VALUE 0
|
||||||
GLOBAL_VALUE NULL
|
GLOBAL_VALUE NULL
|
||||||
|
@ -4,4 +4,5 @@
|
|||||||
--vertical_results
|
--vertical_results
|
||||||
select * from information_schema.system_variables
|
select * from information_schema.system_variables
|
||||||
where variable_name like 'debug%'
|
where variable_name like 'debug%'
|
||||||
|
or variable_name = 'in_predicate_conversion_threshold'
|
||||||
order by variable_name;
|
order by variable_name;
|
||||||
|
@ -30,7 +30,7 @@ perl;
|
|||||||
feedback debug temp-pool ssl des-key-file xtradb sequence
|
feedback debug temp-pool ssl des-key-file xtradb sequence
|
||||||
thread-concurrency super-large-pages mutex-deadlock-detector
|
thread-concurrency super-large-pages mutex-deadlock-detector
|
||||||
connect null-audit aria oqgraph sphinx thread-handling
|
connect null-audit aria oqgraph sphinx thread-handling
|
||||||
test-sql-discovery query-cache-info
|
test-sql-discovery query-cache-info in-predicate-conversion-threshold
|
||||||
query-response-time metadata-lock-info locales unix-socket
|
query-response-time metadata-lock-info locales unix-socket
|
||||||
wsrep file-key-management cracklib-password-check user-variables/;
|
wsrep file-key-management cracklib-password-check user-variables/;
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
#
|
||||||
|
# MDEV-12176 Transform [NOT] IN predicate with long list of values INTO [NOT] IN subquery
|
||||||
|
#
|
||||||
|
source include/have_debug.inc;
|
||||||
|
|
||||||
create table t1 (a int, b int);
|
create table t1 (a int, b int);
|
||||||
|
|
||||||
insert into t1
|
insert into t1
|
||||||
@ -28,7 +33,7 @@ eval explain extended $query;
|
|||||||
|
|
||||||
--echo # set minimum number of values in VALUEs list when optimization works to 2
|
--echo # set minimum number of values in VALUEs list when optimization works to 2
|
||||||
|
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
|
|
||||||
--echo # single IN-predicate in WHERE-part
|
--echo # single IN-predicate in WHERE-part
|
||||||
|
|
||||||
@ -251,27 +256,27 @@ deallocate prepare stmt;
|
|||||||
--echo # use inside out access from tvc rows
|
--echo # use inside out access from tvc rows
|
||||||
|
|
||||||
let $query= select * from t3 where a in (1,4,10);
|
let $query= select * from t3 where a in (1,4,10);
|
||||||
set @@in_subquery_conversion_threshold= default;
|
set @@in_predicate_conversion_threshold= default;
|
||||||
eval $query;
|
eval $query;
|
||||||
eval explain extended $query;
|
eval explain extended $query;
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
eval $query;
|
eval $query;
|
||||||
eval explain extended $query;
|
eval explain extended $query;
|
||||||
|
|
||||||
--echo # use vectors in IN predeicate
|
--echo # use vectors in IN predeicate
|
||||||
|
|
||||||
set @@in_subquery_conversion_threshold= 4;
|
set @@in_predicate_conversion_threshold= 4;
|
||||||
|
|
||||||
let $query=
|
let $query=
|
||||||
select * from t1 where (a,b) in ((1,2),(3,4));
|
select * from t1 where (a,b) in ((1,2),(3,4));
|
||||||
|
|
||||||
eval $query;
|
eval $query;
|
||||||
eval explain extended $query;
|
eval explain extended $query;
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
|
|
||||||
--echo # trasformation works for the one IN predicate and doesn't work for the other
|
--echo # trasformation works for the one IN predicate and doesn't work for the other
|
||||||
|
|
||||||
set @@in_subquery_conversion_threshold= 5;
|
set @@in_predicate_conversion_threshold= 5;
|
||||||
|
|
||||||
let $query=
|
let $query=
|
||||||
select * from t2
|
select * from t2
|
||||||
@ -280,7 +285,7 @@ where (a,b) in ((1,2),(8,9)) and
|
|||||||
|
|
||||||
eval $query;
|
eval $query;
|
||||||
eval explain extended $query;
|
eval explain extended $query;
|
||||||
set @@in_subquery_conversion_threshold= 2;
|
set @@in_predicate_conversion_threshold= 2;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # mdev-14281: conversion of NOT IN predicate into subquery predicate
|
--echo # mdev-14281: conversion of NOT IN predicate into subquery predicate
|
||||||
@ -312,4 +317,4 @@ eval explain extended $query;
|
|||||||
|
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
|
||||||
set @@in_subquery_conversion_threshold= default;
|
set @@in_predicate_conversion_threshold= default;
|
||||||
|
@ -3,12 +3,6 @@
|
|||||||
#
|
#
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
set in_subquery_conversion_threshold=10000;
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
drop table if exists t1, t2, t3, t10, t100;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
event_date date DEFAULT '0000-00-00' NOT NULL,
|
event_date date DEFAULT '0000-00-00' NOT NULL,
|
||||||
type int(11) DEFAULT '0' NOT NULL,
|
type int(11) DEFAULT '0' NOT NULL,
|
||||||
@ -2050,5 +2044,3 @@ drop table t1,t2,t3;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
set in_subquery_conversion_threshold=default;
|
|
||||||
|
@ -4730,6 +4730,8 @@ static int init_common_variables()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global_system_variables.in_subquery_conversion_threshold= IN_SUBQUERY_CONVERSION_THRESHOLD;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ typedef struct system_variables
|
|||||||
uint idle_write_transaction_timeout;
|
uint idle_write_transaction_timeout;
|
||||||
uint column_compression_threshold;
|
uint column_compression_threshold;
|
||||||
uint column_compression_zlib_level;
|
uint column_compression_zlib_level;
|
||||||
ulong in_subquery_conversion_threshold;
|
uint in_subquery_conversion_threshold;
|
||||||
} SV;
|
} SV;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -327,6 +327,8 @@
|
|||||||
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
|
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
|
||||||
#define UNDEF_POS (-1)
|
#define UNDEF_POS (-1)
|
||||||
|
|
||||||
|
#define IN_SUBQUERY_CONVERSION_THRESHOLD 1000
|
||||||
|
|
||||||
#endif /* !MYSQL_CLIENT */
|
#endif /* !MYSQL_CLIENT */
|
||||||
|
|
||||||
/* BINLOG_DUMP options */
|
/* BINLOG_DUMP options */
|
||||||
|
@ -5998,10 +5998,11 @@ static Sys_var_mybool Sys_session_track_state_change(
|
|||||||
|
|
||||||
#endif //EMBEDDED_LIBRARY
|
#endif //EMBEDDED_LIBRARY
|
||||||
|
|
||||||
static Sys_var_ulong Sys_in_subquery_conversion_threshold(
|
#ifndef DBUG_OFF
|
||||||
"in_subquery_conversion_threshold",
|
static Sys_var_uint Sys_in_subquery_conversion_threshold(
|
||||||
|
"in_predicate_conversion_threshold",
|
||||||
"The minimum number of scalar elements in the value list of "
|
"The minimum number of scalar elements in the value list of "
|
||||||
"IN predicate that triggers its conversion to IN subquery",
|
"IN predicate that triggers its conversion to IN subquery",
|
||||||
SESSION_VAR(in_subquery_conversion_threshold), CMD_LINE(OPT_ARG),
|
SESSION_VAR(in_subquery_conversion_threshold), CMD_LINE(OPT_ARG),
|
||||||
VALID_RANGE(0, ULONG_MAX), DEFAULT(1000), BLOCK_SIZE(1));
|
VALID_RANGE(0, UINT_MAX), DEFAULT(IN_SUBQUERY_CONVERSION_THRESHOLD), BLOCK_SIZE(1));
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user