Skip to content

Commit 3f93bb8

Browse files
committed
Optimizer level solution for CORE-2790/CORE-3449.
1 parent 548b24b commit 3f93bb8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/jrd/Optimizer.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,24 @@ void OptimizerRetrieval::getInversionCandidates(InversionCandidateList* inversio
17951795
for (int j = 0; j < scratch.idx->idx_count; j++)
17961796
{
17971797
IndexScratchSegment* segment = scratch.segments[j];
1798+
1799+
// Special case: IS NULL against the in-the-middle segment of the ascending compound index.
1800+
// In ODS11, such a retrieval is not better than the one for the prior segment. So stop before
1801+
// utilizing that segment and leave the boolean for other possible matches.
1802+
if (!(scratch.idx->idx_flags & idx_descending) &&
1803+
segment->scanType == segmentScanMissing &&
1804+
j > 0 && j < scratch.idx->idx_count - 1)
1805+
{
1806+
IndexScratchSegment* const next_segment = scratch.segments[j + 1];
1807+
1808+
if (next_segment->scanType != segmentScanEqual &&
1809+
next_segment->scanType != segmentScanEquivalent &&
1810+
next_segment->scanType != segmentScanMissing)
1811+
{
1812+
break;
1813+
}
1814+
}
1815+
17981816
if (segment->scope == scope) {
17991817
scratch.scopeCandidate = true;
18001818
}

0 commit comments

Comments
 (0)