Skip to content

Commit 79583d6

Browse files
committed
Rework my fix for #5654: Could not execute query (select from view with nested view) -- the original solution was too restrictive, causing regressions in plans/performance
1 parent b0c36f0 commit 79583d6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/jrd/optimizer/Optimizer.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,14 +1971,15 @@ void Optimizer::checkSorts()
19711971

19721972
unsigned Optimizer::distributeEqualities(BoolExprNodeStack& orgStack, unsigned baseCount)
19731973
{
1974-
// dimitr: Dumb protection against too many injected conjuncts (see CORE-5381).
1975-
// Don't produce more additional conjuncts than we originally had
1976-
// (i.e. this routine should never more than double the number of conjuncts).
1977-
// Ideally, we need two separate limits here:
1978-
// 1) number of injected conjuncts (affects required impure size)
1979-
// 2) number of input conjuncts (affects search time inside this routine)
1980-
1981-
if (baseCount * 2 > MAX_CONJUNCTS)
1974+
// dimitr: Simplified protection against too many injected conjuncts (see CORE-5381).
1975+
// Two separate limits are applied here:
1976+
// 1) number of input conjuncts (affects search time inside this routine)
1977+
// 2) number of injected conjuncts (affects required impure size)
1978+
1979+
constexpr unsigned MAX_CONJUNCTS_TO_PROCESS = 1024;
1980+
const unsigned MAX_CONJUNCTS_TO_INJECT = MAX(baseCount, 256);
1981+
1982+
if (baseCount > MAX_CONJUNCTS_TO_PROCESS)
19821983
return 0;
19831984

19841985
ObjectsArray<ValueExprNodeStack> classes;

0 commit comments

Comments
 (0)