8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +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,6 +1393,21 @@ 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;
if (currentInv->boolean)
{
if (matches.exist(currentInv->boolean))
{
anyMatchAlreadyUsed = true;
if (navigationCandidate &&
navigationCandidate->matches.exist(currentInv->boolean))
{
matchUsedByNavigation = true;
}
}
}
else
{
for (const auto currentMatch : currentInv->matches) for (const auto currentMatch : currentInv->matches)
{ {
if (matches.exist(currentMatch)) if (matches.exist(currentMatch))
@ -1408,6 +1423,7 @@ InversionCandidate* Retrieval::makeInversion(InversionCandidateList& inversions)
break; break;
} }
} }
}
if (currentInv->boolean && matches.exist(currentInv->boolean)) if (currentInv->boolean && matches.exist(currentInv->boolean))
anyMatchAlreadyUsed = true; anyMatchAlreadyUsed = true;