Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3e4818e

Browse filesBrowse files
committed
Avoid unnecessary shm writes in Parallel Hash Join.
Currently, Parallel Hash Join cannot be used for full/right joins, so there is no point in setting the match flag. It turns out that the cache coherence traffic generated by those writes slows down large systems running many-core joins, so let's stop doing that. In future, if we need to use match bits in parallel joins, we might want to consider setting them only if not already set. Back-patch to 11, where Parallel Hash Join arrived. Reported-by: Deng, Gang Discussion: https://postgr.es/m/0F44E799048C4849BAE4B91012DB910462E9897A%40SHSMSX103.ccr.corp.intel.com
1 parent 10a5252 commit 3e4818e
Copy full SHA for 3e4818e

File tree

Expand file treeCollapse file tree

1 file changed

+20
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-1
lines changed

‎src/backend/executor/nodeHashjoin.c

Copy file name to clipboardExpand all lines: src/backend/executor/nodeHashjoin.c
+20-1Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,26 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel)
454454
if (joinqual == NULL || ExecQual(joinqual, econtext))
455455
{
456456
node->hj_MatchedOuter = true;
457-
HeapTupleHeaderSetMatch(HJTUPLE_MINTUPLE(node->hj_CurTuple));
457+
458+
if (parallel)
459+
{
460+
/*
461+
* Full/right outer joins are currently not supported
462+
* for parallel joins, so we don't need to set the
463+
* match bit. Experiments show that it's worth
464+
* avoiding the shared memory traffic on large
465+
* systems.
466+
*/
467+
Assert(!HJ_FILL_INNER(node));
468+
}
469+
else
470+
{
471+
/*
472+
* This is really only needed if HJ_FILL_INNER(node),
473+
* but we'll avoid the branch and just set it always.
474+
*/
475+
HeapTupleHeaderSetMatch(HJTUPLE_MINTUPLE(node->hj_CurTuple));
476+
}
458477

459478
/* In an antijoin, we never return a matched tuple */
460479
if (node->js.jointype == JOIN_ANTI)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.