Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "gpopt/operators/CPredicateUtils.h"
#include "gpopt/operators/CScalarProjectList.h"

namespace gpdb
{
bool IsParallelModeOK(void);
}



using namespace gpopt;
Expand Down Expand Up @@ -63,6 +68,16 @@ CXformLeftSemiJoin2InnerJoin::CXformLeftSemiJoin2InnerJoin(CMemoryPool *mp)
CXform::EXformPromise
CXformLeftSemiJoin2InnerJoin::Exfp(CExpressionHandle &exprhdl) const
{
/*
* In parallel mode, prefer direct semi-join implementations. Rewriting a
* semi-join to an inner join plus dedup can produce unstable ORCA plans
* for parallel queries.
*/
if (gpdb::IsParallelModeOK())
{
return ExfpNone;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling them removes a plan candidate that may have been the cost-optimal choice even for some serial queries in a parallel-enabled session, we need to find root cause .

}

if (exprhdl.HasOuterRefs() || exprhdl.DeriveHasSubquery(2))
{
return ExfpNone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "gpopt/operators/CPredicateUtils.h"
#include "gpopt/operators/CScalarProjectList.h"

namespace gpdb
{
bool IsParallelModeOK(void);
}

using namespace gpopt;

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -60,6 +65,16 @@ CXformLeftSemiJoin2InnerJoinUnderGb::CXformLeftSemiJoin2InnerJoinUnderGb(
CXform::EXformPromise
CXformLeftSemiJoin2InnerJoinUnderGb::Exfp(CExpressionHandle &exprhdl) const
{
/*
* In parallel mode, prefer direct semi-join implementations. Rewriting a
* semi-join to an inner join plus dedup can produce unstable ORCA plans
* for parallel queries.
*/
if (gpdb::IsParallelModeOK())
{
return ExfpNone;
}

CColRefSet *pcrsInnerOutput = exprhdl.DeriveOutputColumns(1);
CExpression *pexprScalar = exprhdl.PexprScalarExactChild(2);
CAutoMemoryPool amp;
Expand Down