Skip to content

Commit 71f51d9

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 46480a7 commit 71f51d9

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
@@ -2059,14 +2059,15 @@ void Optimizer::checkSorts()
20592059

20602060
unsigned Optimizer::distributeEqualities(BoolExprNodeStack& orgStack, unsigned baseCount)
20612061
{
2062-
// dimitr: Dumb protection against too many injected conjuncts (see CORE-5381).
2063-
// Don't produce more additional conjuncts than we originally had
2064-
// (i.e. this routine should never more than double the number of conjuncts).
2065-
// Ideally, we need two separate limits here:
2066-
// 1) number of injected conjuncts (affects required impure size)
2067-
// 2) number of input conjuncts (affects search time inside this routine)
2068-
2069-
if (baseCount * 2 > MAX_CONJUNCTS)
2062+
// dimitr: Simplified protection against too many injected conjuncts (see CORE-5381).
2063+
// Two separate limits are applied here:
2064+
// 1) number of input conjuncts (affects search time inside this routine)
2065+
// 2) number of injected conjuncts (affects required impure size)
2066+
2067+
constexpr unsigned MAX_CONJUNCTS_TO_PROCESS = 1024;
2068+
const unsigned MAX_CONJUNCTS_TO_INJECT = MAX(baseCount, 256);
2069+
2070+
if (baseCount > MAX_CONJUNCTS_TO_PROCESS)
20702071
return 0;
20712072

20722073
ObjectsArray<ValueExprNodeStack> classes;

0 commit comments

Comments
 (0)