From ff9f72c68f678ded340b431c3e280fe56644a3e7 Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Wed, 10 Apr 2024 02:07:34 +0300 Subject: revert: Transform OR clauses to ANY expression This commit reverts 72bd38cc99 due to implementation and design issues. Reported-by: Tom Lane Discussion: https://postgr.es/m/3604469.1712628736%40sss.pgh.pa.us --- doc/src/sgml/config.sgml | 57 ------------------------------------------------ 1 file changed, 57 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index ac945ca4d19..d8e1282e128 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -6304,63 +6304,6 @@ SELECT * FROM parent WHERE key = 2400; - - or_to_any_transform_limit (boolean) - - or_to_any_transform_limit configuration parameter - - - - - Sets the minimum length of arguments in an OR - expression exceeding which planner will try to lookup and group - multiple similar OR expressions to - ANY () - expressions. The grouping technique of this transformation is based - on the equivalence of variable sides. One side of such an expression - must be a constant clause, and the other must contain a variable - clause. The default value is 5. The value of - -1 completely disables the transformation. - - - The advantage of this OR-to-ANY transformation is - faster query planning and execution. In certain cases, this - transformation also leads to more effective plans containing - a single index scan instead of multiple bitmap scans. However, it - may also cause a planning regression when distinct - OR arguments are better to match to distinct indexes. - This may happen when they have different matching partial indexes or - have different distributions of other columns used in the query. - Generally, more groupable OR arguments mean that - transformation will be more likely to win than to lose. - - - For example, this query has its set of five OR - expressions transformed to ANY with the default - value of or_to_any_transform_limit. But not with - the increased value. - -# EXPLAIN SELECT * FROM tbl WHERE key = 1 OR key = 2 OR key = 3 OR key = 4 OR key = 5; - QUERY PLAN ------------------------------------------------------ - Seq Scan on tbl (cost=0.00..51.44 rows=64 width=4) - Filter: (key = ANY ('{1,2,3,4,5}'::integer[])) -(2 rows) - -# SET or_to_any_transform_limit = 6; -SET - -# EXPLAIN SELECT * FROM tbl WHERE key = 1 OR key = 2 OR key = 3 OR key = 4 OR key = 5; - QUERY PLAN ---------------------------------------------------------------------------- - Seq Scan on tbl (cost=0.00..67.38 rows=63 width=4) - Filter: ((key = 1) OR (key = 2) OR (key = 3) OR (key = 4) OR (key = 5)) -(2 rows) - - - - - plan_cache_mode (enum) -- cgit v1.2.3