These settings are available in system.settings and are autogenerated from source.
optimize_or_like_chain
Optimize multiple OR LIKE/ILIKE/match predicates on the same expression into a single multiSearchAny/multiSearchAnyCaseInsensitiveUTF8 (for pure-substring %needle% patterns) or multiMatchAny (for other patterns, when Hyperscan/Vectorscan is permitted). When neither fast path is applicable — for example when Hyperscan is disabled or unavailable, or the patterns are raw match regexps, not valid UTF-8, contain an embedded NUL, or the haystack is FixedString/Enum — the original OR chain is kept unchanged, because a combined match alternation over RE2 is consistently slower than the original short-circuit OR.
The optimization is applied only with the analyzer (enable_analyzer = 1, the default); with the old analyzer (enable_analyzer = 0) the OR chain is left unchanged. For pure LIKE/ILIKE/match OR chains the original expressions are preserved in indexHint() to allow index analysis; mixed OR chains that include non-LIKE branches intentionally skip indexHint() wrapping so that ranges matching only the non-LIKE branch are not pruned. The multiMatchAny rewrite honors allow_hyperscan, max_hyperscan_regexp_length, max_hyperscan_regexp_total_length and reject_expensive_hyperscan_regexps.
A chain is rewritten only when it has enough branches sharing the same left-hand-side expression to make the rewrite reliably faster than short-circuit OR evaluation: at least optimize_or_like_chain_min_substrings branches for the multiSearchAny path, and at least optimize_or_like_chain_min_patterns branches for the multiMatchAny path.
optimize_or_like_chain_min_patterns
Minimum number of non-pure-substring LIKE/ILIKE/match branches (prefix/suffix/regexp patterns), sharing the same left-hand-side expression, required for optimize_or_like_chain to rewrite a chain into multiMatchAny. Calibrated on the hits dataset (see tests/performance/optimize_or_like_chain_hits.xml): a multiMatchAny (Hyperscan) rewrite of prefix/regexp LIKE chains only becomes faster than short-circuit OR evaluation from about nine branches, so shorter chains are kept as-is to avoid regressing them. A value of 0 or 1 disables the threshold. Has no effect when optimize_or_like_chain is disabled. See also optimize_or_like_chain_min_substrings for the pure-substring (multiSearchAny) path.
optimize_or_like_chain_min_substrings
Minimum number of pure-substring (%needle%) LIKE/ILIKE branches, sharing the same left-hand-side expression, required for optimize_or_like_chain to rewrite a chain into multiSearchAny/multiSearchAnyCaseInsensitiveUTF8. Calibrated on the hits dataset (see tests/performance/optimize_or_like_chain_hits.xml): the multiSearchAny rewrite becomes faster than short-circuit OR evaluation from about four branches. A value of 0 or 1 disables the threshold. Has no effect when optimize_or_like_chain is disabled. See also optimize_or_like_chain_min_patterns for the regexp (multiMatchAny) path. Last modified on July 23, 2026