Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVPi1-0001Nu-N8 for pgsql-committers@arkaria.postgresql.org; Sat, 30 Dec 2017 22:34:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVPi0-0007Tm-Bn for pgsql-committers@arkaria.postgresql.org; Sat, 30 Dec 2017 22:34:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eVPi0-0007Tb-2D for pgsql-committers@lists.postgresql.org; Sat, 30 Dec 2017 22:34:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eVPht-0002Zh-Ba for pgsql-committers@postgresql.org; Sat, 30 Dec 2017 22:34:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vBUMYHiZ030656; Sat, 30 Dec 2017 17:34:17 -0500 From: Tom Lane To: Thomas Munro cc: Andres Freund , pgsql-committers Subject: Re: pgsql: Add parallel-aware hash joins. In-reply-to: References: <20171221092940.gbxcszbzsr5khsfr@alap3.anarazel.de> <20171221095550.d3e7xhoakcowhu5b@alap3.anarazel.de> <20171222082203.fl6rpzlqnm4h7h6h@alap3.anarazel.de> <30219.1514428346@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Sun, 31 Dec 2017 02:51:26 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30654.1514673257.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 30 Dec 2017 17:34:17 -0500 Message-ID: <30655.1514673257@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Munro writes: >> This is explained by the early exit case in >> ExecParallelHashEnsureBatchAccessors(). With just the right timing, >> it finishes up not reporting the true nbatch number, and never calling >> ExecParallelHashUpdateSpacePeak(). > Hi Tom, > You mentioned that prairiedog sees the problem about one time in > thirty. Would you mind checking if it goes away with this patch > applied? I've run 55 cycles of "make installcheck" without seeing a failure with this patch installed. That's not enough to be totally sure of course, but I think this probably fixes it. However ... I noticed that my other dinosaur gaur shows the other failure mode we see in the buildfarm, the "increased_batches =3D t" diff, and I can report that this patch does *not* help that. The underlying EXPLAIN output goes from something like ! Finalize Aggregate (cost=3D823.85..823.86 rows=3D1 width=3D8) (actual = time=3D1378.102..1378.105 rows=3D1 loops=3D1) ! -> Gather (cost=3D823.63..823.84 rows=3D2 width=3D8) (actual time=3D= 1377.909..1378.006 rows=3D3 loops=3D1) ! Workers Planned: 2 ! Workers Launched: 2 ! -> Partial Aggregate (cost=3D823.63..823.64 rows=3D1 width=3D= 8) (actual time=3D1280.298..1280.302 rows=3D1 loops=3D3) ! -> Parallel Hash Join (cost=3D387.50..802.80 rows=3D833= 3 width=3D0) (actual time=3D1070.179..1249.142 rows=3D6667 loops=3D3) ! Hash Cond: (r.id =3D s.id) ! -> Parallel Seq Scan on simple r (cost=3D0.00..25= 0.33 rows=3D8333 width=3D4) (actual time=3D0.173..62.063 rows=3D6667 loops= =3D3) ! -> Parallel Hash (cost=3D250.33..250.33 rows=3D83= 33 width=3D4) (actual time=3D454.305..454.305 rows=3D6667 loops=3D3) ! Buckets: 4096 Batches: 8 Memory Usage: 208k= B ! -> Parallel Seq Scan on simple s (cost=3D0.= 00..250.33 rows=3D8333 width=3D4) (actual time=3D0.178..67.115 rows=3D6667= loops=3D3) ! Planning time: 1.861 ms ! Execution time: 1687.311 ms to something like ! Finalize Aggregate (cost=3D823.85..823.86 rows=3D1 width=3D8) (actual = time=3D1588.733..1588.737 rows=3D1 loops=3D1) ! -> Gather (cost=3D823.63..823.84 rows=3D2 width=3D8) (actual time=3D= 1588.529..1588.634 rows=3D3 loops=3D1) ! Workers Planned: 2 ! Workers Launched: 2 ! -> Partial Aggregate (cost=3D823.63..823.64 rows=3D1 width=3D= 8) (actual time=3D1492.631..1492.635 rows=3D1 loops=3D3) ! -> Parallel Hash Join (cost=3D387.50..802.80 rows=3D833= 3 width=3D0) (actual time=3D1270.309..1451.501 rows=3D6667 loops=3D3) ! Hash Cond: (r.id =3D s.id) ! -> Parallel Seq Scan on simple r (cost=3D0.00..25= 0.33 rows=3D8333 width=3D4) (actual time=3D0.219..158.144 rows=3D6667 loop= s=3D3) ! -> Parallel Hash (cost=3D250.33..250.33 rows=3D83= 33 width=3D4) (actual time=3D634.614..634.614 rows=3D6667 loops=3D3) ! Buckets: 4096 (originally 4096) Batches: 16 = (originally 8) Memory Usage: 176kB ! -> Parallel Seq Scan on simple s (cost=3D0.= 00..250.33 rows=3D8333 width=3D4) (actual time=3D0.182..120.074 rows=3D666= 7 loops=3D3) ! Planning time: 1.931 ms ! Execution time: 2219.417 ms so again we have a case where the plan didn't change but the execution behavior did. This isn't quite 100% reproducible on gaur/pademelon, but it fails more often than not seems like, so I can poke into it if you can say what info would be helpful. regards, tom lane