fix_hardtokill_hashv2.patch

text/x-patch

Filename: fix_hardtokill_hashv2.patch
Type: text/x-patch
Part: 0
Message: Re: [PERFORM] Hash Anti Join performance degradation

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/executor/nodeHashjoin.c 3 0
commit 597f6857ecb98572171a96c08a3be434362ac70f
Author: Cédric Villemain <cedric@2ndquadrant.fr>
Date:   Wed Jun 1 21:30:56 2011 +0200

    Add a CHECK_FOR_INTERRUPTS() in the hash(anti)join
    
    The CHECK is in one place where the loop happens really.
    It looks enough to break if it is signaled while not executed for each case
    in the upper for(;;)

diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 26da3b2..cef19d8 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -14,6 +14,7 @@
  */
 
 #include "postgres.h"
+#include "miscadmin.h"
 
 #include "executor/executor.h"
 #include "executor/hashjoin.h"
@@ -264,7 +265,9 @@ ExecHashJoin(HashJoinState *node)
 
 				/*
 				 * Scan the selected hash bucket for matches to current outer
+				 * And let the backend give up if it has been signaled.
 				 */
+				CHECK_FOR_INTERRUPTS();
 				if (!ExecScanHashBucket(node, econtext))
 				{
 					/* out of matches; check for possible outer-join fill */