From 6cb8eacb9a43487c57f3a1da83ce7dc501a4955a Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Mon, 4 Apr 2022 10:44:45 +0300 Subject: [PATCH] Fixed index navigation in inner joins. --- src/jrd/optimizer/InnerJoin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jrd/optimizer/InnerJoin.cpp b/src/jrd/optimizer/InnerJoin.cpp index 519188645b..6e9b49b3a8 100644 --- a/src/jrd/optimizer/InnerJoin.cpp +++ b/src/jrd/optimizer/InnerJoin.cpp @@ -304,7 +304,6 @@ void InnerJoin::findBestOrder(unsigned position, // Do some initializations tail->activate(); joinedStreams[position].number = stream->stream; - position++; // Save the various flag bits from the optimizer block to reset its // state after each test @@ -322,6 +321,8 @@ void InnerJoin::findBestOrder(unsigned position, newCardinality = positionCardinality * cardinality; } + position++; + // If the partial order is either longer than any previous partial order, // or the same length and cheap, save order as "best" if (position > bestCount || (position == bestCount && newCost < bestCost))