2011/6/1 Tom Lane <t...@sss.pgh.pa.us>:
> We do need to look into putting a CHECK_FOR_INTERRUPTS call in here
> somewhere, though.  I'm inclined to think that right before the
> ExecScanHashBucket is the best place.  The reason that nest and merge
> joins don't show a comparable non-responsiveness to cancels is that they
> always call a child plan node at the equivalent place, and ExecProcNode
> has got a CHECK_FOR_INTERRUPTS.  So we ought to check for interrupts
> at the point of "fetching a tuple from the inner child plan", and
> ExecScanHashBucket is the equivalent thing in this logic.  Cedric's
> suggestion of putting it before the switch would get the job done, but
> it would result in wasting cycles during unimportant transitions from
> one state machine state to another.


exact, thanks to your last email I read more the code and get the same
conclusion and put it in a more appropriate place : before
ExecScanHashBucket.

I was about sending it, so it is attached.



>
>                        regards, tom lane
>



-- 
Cédric Villemain               2ndQuadrant
http://2ndQuadrant.fr/     PostgreSQL : Expertise, Formation et Support
commit 597f6857ecb98572171a96c08a3be434362ac70f
Author: Cédric Villemain <ced...@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 */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to