Skip to content

Commit 08b01ac

Browse files
committed
MDEV-16871 in_predicate_conversion_threshold cannot be set in my.cnf
1 parent 7e08ac0 commit 08b01ac

File tree

10 files changed

+35
-29
lines changed

10 files changed

+35
-29
lines changed

mysql-test/main/mysqld--help.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ The following specify which files/extra groups are read (specified before remain
346346
Specifies a directory to add to the ignore list when
347347
collecting database names from the datadir. Put a blank
348348
argument to reset the list accumulated so far.
349+
--in-predicate-conversion-threshold=#
350+
The minimum number of scalar elements in the value list
351+
of IN predicate that triggers its conversion to IN
352+
subquery. Set to 0 to disable the conversion.
349353
--init-connect=name Command(s) that are executed for each new connection
350354
(unless the user has SUPER privilege)
351355
--init-file=name Read SQL commands from this file at startup
@@ -1442,6 +1446,7 @@ idle-transaction-timeout 0
14421446
idle-write-transaction-timeout 0
14431447
ignore-builtin-innodb FALSE
14441448
ignore-db-dirs
1449+
in-predicate-conversion-threshold 1000
14451450
init-connect
14461451
init-file (No default value)
14471452
init-rpl-role MASTER

mysql-test/main/mysqld--help.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ perl;
3030
feedback debug temp-pool ssl des-key-file xtradb sequence
3131
thread-concurrency super-large-pages mutex-deadlock-detector
3232
connect null-audit aria oqgraph sphinx thread-handling
33-
test-sql-discovery query-cache-info in-predicate-conversion-threshold
33+
test-sql-discovery query-cache-info
3434
query-response-time metadata-lock-info locales unix-socket
3535
wsrep file-key-management cracklib-password-check user-variables/;
3636

mysql-test/main/opt_tvc.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# MDEV-12176 Transform [NOT] IN predicate with long list of values INTO [NOT] IN subquery
33
#
44
source include/have_debug.inc;
5-
--source include/default_optimizer_switch.inc
5+
source include/default_optimizer_switch.inc;
66

77
create table t1 (a int, b int);
88

mysql-test/suite/sys_vars/inc/sysvars_server.inc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ select VARIABLE_NAME,VARIABLE_SCOPE,VARIABLE_TYPE,VARIABLE_COMMENT,NUMERIC_MIN_V
2323
variable_name not like 'wsrep%' and
2424
variable_name not like 's3%' and
2525
variable_name not in (
26-
'log_tc_size',
27-
'in_predicate_conversion_threshold'
26+
'log_tc_size'
2827
)
2928
order by variable_name;
3029

mysql-test/suite/sys_vars/r/sysvars_debug.result

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
select * from information_schema.system_variables
22
where variable_name like 'debug%'
3-
or variable_name = 'in_predicate_conversion_threshold'
43
order by variable_name;
54
VARIABLE_NAME DEBUG
65
SESSION_VALUE
@@ -86,17 +85,3 @@ NUMERIC_BLOCK_SIZE NULL
8685
ENUM_VALUE_LIST NULL
8786
READ_ONLY NO
8887
COMMAND_LINE_ARGUMENT NULL
89-
VARIABLE_NAME IN_PREDICATE_CONVERSION_THRESHOLD
90-
SESSION_VALUE 1000
91-
GLOBAL_VALUE 1000
92-
GLOBAL_VALUE_ORIGIN COMPILE-TIME
93-
DEFAULT_VALUE 1000
94-
VARIABLE_SCOPE SESSION
95-
VARIABLE_TYPE INT UNSIGNED
96-
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery
97-
NUMERIC_MIN_VALUE 0
98-
NUMERIC_MAX_VALUE 4294967295
99-
NUMERIC_BLOCK_SIZE 1
100-
ENUM_VALUE_LIST NULL
101-
READ_ONLY NO
102-
COMMAND_LINE_ARGUMENT OPTIONAL

mysql-test/suite/sys_vars/r/sysvars_server_embedded.result

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ where variable_name not like 'debug%' and
99
variable_name not like 'wsrep%' and
1010
variable_name not like 's3%' and
1111
variable_name not in (
12-
'log_tc_size',
13-
'in_predicate_conversion_threshold'
12+
'log_tc_size'
1413
)
1514
order by variable_name;
1615
VARIABLE_NAME ALTER_ALGORITHM
@@ -1293,6 +1292,16 @@ NUMERIC_BLOCK_SIZE 1
12931292
ENUM_VALUE_LIST NULL
12941293
READ_ONLY NO
12951294
COMMAND_LINE_ARGUMENT REQUIRED
1295+
VARIABLE_NAME IN_PREDICATE_CONVERSION_THRESHOLD
1296+
VARIABLE_SCOPE SESSION
1297+
VARIABLE_TYPE INT UNSIGNED
1298+
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery. Set to 0 to disable the conversion.
1299+
NUMERIC_MIN_VALUE 0
1300+
NUMERIC_MAX_VALUE 4294967295
1301+
NUMERIC_BLOCK_SIZE 1
1302+
ENUM_VALUE_LIST NULL
1303+
READ_ONLY NO
1304+
COMMAND_LINE_ARGUMENT REQUIRED
12961305
VARIABLE_NAME IN_TRANSACTION
12971306
VARIABLE_SCOPE SESSION ONLY
12981307
VARIABLE_TYPE BIGINT UNSIGNED

mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ where variable_name not like 'debug%' and
99
variable_name not like 'wsrep%' and
1010
variable_name not like 's3%' and
1111
variable_name not in (
12-
'log_tc_size',
13-
'in_predicate_conversion_threshold'
12+
'log_tc_size'
1413
)
1514
order by variable_name;
1615
VARIABLE_NAME ALTER_ALGORITHM
@@ -1383,6 +1382,16 @@ NUMERIC_BLOCK_SIZE 1
13831382
ENUM_VALUE_LIST NULL
13841383
READ_ONLY NO
13851384
COMMAND_LINE_ARGUMENT REQUIRED
1385+
VARIABLE_NAME IN_PREDICATE_CONVERSION_THRESHOLD
1386+
VARIABLE_SCOPE SESSION
1387+
VARIABLE_TYPE INT UNSIGNED
1388+
VARIABLE_COMMENT The minimum number of scalar elements in the value list of IN predicate that triggers its conversion to IN subquery. Set to 0 to disable the conversion.
1389+
NUMERIC_MIN_VALUE 0
1390+
NUMERIC_MAX_VALUE 4294967295
1391+
NUMERIC_BLOCK_SIZE 1
1392+
ENUM_VALUE_LIST NULL
1393+
READ_ONLY NO
1394+
COMMAND_LINE_ARGUMENT REQUIRED
13861395
VARIABLE_NAME IN_TRANSACTION
13871396
VARIABLE_SCOPE SESSION ONLY
13881397
VARIABLE_TYPE BIGINT UNSIGNED

mysql-test/suite/sys_vars/t/sysvars_debug.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
--vertical_results
55
select * from information_schema.system_variables
66
where variable_name like 'debug%'
7-
or variable_name = 'in_predicate_conversion_threshold'
87
order by variable_name;

sql/sql_tvc.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,8 @@ bool Item_func_in::to_be_transformed_into_in_subq(THD *thd)
972972
if (args[1]->type() == Item::ROW_ITEM)
973973
values_count*= ((Item_row *)(args[1]))->cols();
974974

975-
if (values_count < thd->variables.in_subquery_conversion_threshold)
975+
if (thd->variables.in_subquery_conversion_threshold == 0 ||
976+
thd->variables.in_subquery_conversion_threshold > values_count)
976977
return false;
977978

978979
return true;

sql/sys_vars.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6192,14 +6192,13 @@ static Sys_var_mybool Sys_session_track_state_change(
61926192

61936193
#endif //EMBEDDED_LIBRARY
61946194

6195-
#ifndef DBUG_OFF
61966195
static Sys_var_uint Sys_in_subquery_conversion_threshold(
61976196
"in_predicate_conversion_threshold",
61986197
"The minimum number of scalar elements in the value list of "
6199-
"IN predicate that triggers its conversion to IN subquery",
6200-
SESSION_VAR(in_subquery_conversion_threshold), CMD_LINE(OPT_ARG),
6198+
"IN predicate that triggers its conversion to IN subquery. Set to "
6199+
"0 to disable the conversion.",
6200+
SESSION_VAR(in_subquery_conversion_threshold), CMD_LINE(REQUIRED_ARG),
62016201
VALID_RANGE(0, UINT_MAX), DEFAULT(IN_SUBQUERY_CONVERSION_THRESHOLD), BLOCK_SIZE(1));
6202-
#endif
62036202

62046203
static Sys_var_enum Sys_secure_timestamp(
62056204
"secure_timestamp", "Restricts direct setting of a session "

0 commit comments

Comments
 (0)