8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 17:23:03 +01:00

Better (methinks) inversion choice when the OR condition includes a node which is also matched directly

This commit is contained in:
Dmitry Yemanov 2024-03-11 10:19:49 +03:00
parent b8014996a6
commit ebcd4dde64

View File

@ -1393,19 +1393,35 @@ InversionCandidate* Retrieval::makeInversion(InversionCandidateList& inversions)
// Look if a match is already used by previous matches. // Look if a match is already used by previous matches.
bool anyMatchAlreadyUsed = false, matchUsedByNavigation = false; bool anyMatchAlreadyUsed = false, matchUsedByNavigation = false;
for (const auto currentMatch : currentInv->matches) if (currentInv->boolean)
{ {
if (matches.exist(currentMatch)) if (matches.exist(currentInv->boolean))
{ {
anyMatchAlreadyUsed = true; anyMatchAlreadyUsed = true;
if (navigationCandidate && if (navigationCandidate &&
navigationCandidate->matches.exist(currentMatch)) navigationCandidate->matches.exist(currentInv->boolean))
{ {
matchUsedByNavigation = true; matchUsedByNavigation = true;
} }
}
}
else
{
for (const auto currentMatch : currentInv->matches)
{
if (matches.exist(currentMatch))
{
anyMatchAlreadyUsed = true;
break; if (navigationCandidate &&
navigationCandidate->matches.exist(currentMatch))
{
matchUsedByNavigation = true;
}
break;
}
} }
} }