Starting from MariaDB 10.3, the optimizer will convert certain big IN predicates into IN subqueries.
That is, an IN predicate in the form
column [NOT] IN (const1, const2, .... )
is converted into an equivalent IN-subquery:
column [NOT] IN (select ... from temporary_table)
which opens new opportunities for the query optimizer.
The conversion happens if the following conditions are met:
- the IN list has more than 1000 elements (The threshold number is hard-coded in the release builds, in debug builds, one can control it through the @@in_predicate_conversion_threshold
parameter). - the [NOT] IN condition is at the top level of the WHERE/ON clause.
@@in_predicate_conversion_threshold
variable.
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/conversion-of-big-in-predicates-into-subqueries/