Re: Wrong results from Parallel Hash Full Join

2023-06-12 Thread Melanie Plageman
On Sun, Jun 11, 2023 at 11:24 PM Michael Paquier wrote: > > On Wed, Jun 07, 2023 at 05:16:12PM -0400, Melanie Plageman wrote: > > On Fri, May 19, 2023 at 8:05 PM Tom Lane wrote: > >> Considering that this is a parallel plan, I don't think there's any > >> mystery about why an ORDER-BY-less query

Re: Wrong results from Parallel Hash Full Join

2023-06-11 Thread Tom Lane
Michael Paquier writes: > This has fallen through the cracks and conchuela has failed again > today, so I went ahead and applied the fix on HEAD. Thanks! Thanks! I'd intended to push that but it didn't get to the top of the to-do queue yet. (I'm still kind of wondering why only conchuela has f

Re: Wrong results from Parallel Hash Full Join

2023-06-11 Thread Michael Paquier
On Wed, Jun 07, 2023 at 05:16:12PM -0400, Melanie Plageman wrote: > On Fri, May 19, 2023 at 8:05 PM Tom Lane wrote: >> Considering that this is a parallel plan, I don't think there's any >> mystery about why an ORDER-BY-less query might have unstable output >> order; the only mystery is why more o

Re: Wrong results from Parallel Hash Full Join

2023-06-07 Thread Melanie Plageman
On Fri, May 19, 2023 at 8:05 PM Tom Lane wrote: > > I noticed that BF animal conchuela has several times fallen over on the > test case added by 558c9d75f: > > diff -U3 > /home/pgbf/buildroot/HEAD/pgsql.build/src/test/regress/expected/join_hash.out > /home/pgbf/buildroot/HEAD/pgsql.build/src/tes

Re: Wrong results from Parallel Hash Full Join

2023-05-19 Thread Tom Lane
I noticed that BF animal conchuela has several times fallen over on the test case added by 558c9d75f: diff -U3 /home/pgbf/buildroot/HEAD/pgsql.build/src/test/regress/expected/join_hash.out /home/pgbf/buildroot/HEAD/pgsql.build/src/test/regress/results/join_hash.out --- /home/pgbf/buildroot/HEAD

Re: Wrong results from Parallel Hash Full Join

2023-04-20 Thread Justin Pryzby
On Wed, Apr 19, 2023 at 08:47:07PM -0400, Melanie Plageman wrote: > On Wed, Apr 19, 2023 at 8:41 PM Justin Pryzby wrote: > > > > On Wed, Apr 19, 2023 at 12:20:51PM -0700, Andres Freund wrote: > > > On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: > > > > On Wed, Apr 19, 2023 at 11:17:04AM -0400,

Re: Wrong results from Parallel Hash Full Join

2023-04-20 Thread Melanie Plageman
On Wed, Apr 19, 2023 at 8:43 PM Melanie Plageman wrote: > On Wed, Apr 19, 2023 at 3:20 PM Andres Freund wrote: >> On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: >> > On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: >> > > Ultimately this is probably fine. If we wanted to modi

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Melanie Plageman
On Wed, Apr 19, 2023 at 8:41 PM Justin Pryzby wrote: > > On Wed, Apr 19, 2023 at 12:20:51PM -0700, Andres Freund wrote: > > On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: > > > On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: > > > > Ultimately this is probably fine. If we wan

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Melanie Plageman
On Wed, Apr 19, 2023 at 3:20 PM Andres Freund wrote: > Hi, > > On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: > > On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: > > > Ultimately this is probably fine. If we wanted to modify one of the > > > existing tests to cover the multi

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Justin Pryzby
On Wed, Apr 19, 2023 at 12:20:51PM -0700, Andres Freund wrote: > On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: > > On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: > > > Ultimately this is probably fine. If we wanted to modify one of the > > > existing tests to cover the multi

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Andres Freund
Hi, On 2023-04-19 12:16:24 -0500, Justin Pryzby wrote: > On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: > > Ultimately this is probably fine. If we wanted to modify one of the > > existing tests to cover the multi-batch case, changing the select > > count(*) to a select * would

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Justin Pryzby
On Wed, Apr 19, 2023 at 11:17:04AM -0400, Melanie Plageman wrote: > Ultimately this is probably fine. If we wanted to modify one of the > existing tests to cover the multi-batch case, changing the select > count(*) to a select * would do the trick. I imagine we wouldn't want to > do this because of

Re: Wrong results from Parallel Hash Full Join

2023-04-19 Thread Melanie Plageman
On Wed, Apr 12, 2023 at 08:31:26PM -0400, Melanie Plageman wrote: > On Wed, Apr 12, 2023 at 6:50 PM Thomas Munro wrote: > > And if we're going to > > exercise/test that case, should we do the non-parallel version too? > > I've added this. I thought if we were adding the serial case, we might > as

Re: Wrong results from Parallel Hash Full Join

2023-04-14 Thread Robert Haas
On Thu, Apr 13, 2023 at 7:06 PM Thomas Munro wrote: > For some reason I thought we weren't supposed to use the flat thing, > but it looks like I'm just wrong and people do that all the time so I > take that back. > > Pushed. Thanks Richard and Melanie. I tend to use http://postgr.es/m/ or https:

Re: Wrong results from Parallel Hash Full Join

2023-04-13 Thread Thomas Munro
On Thu, Apr 13, 2023 at 12:31 PM Melanie Plageman wrote: > On Wed, Apr 12, 2023 at 6:50 PM Thomas Munro wrote: > > I think "Discussion:" footers are supposed to use > > https://postgr.es/m/XXX shortened URLs. > > Hmm. Is the problem with mine that I included "flat"? Because I did use > postgr.es

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Melanie Plageman
On Wed, Apr 12, 2023 at 6:50 PM Thomas Munro wrote: > > On Thu, Apr 13, 2023 at 9:48 AM Melanie Plageman > wrote: > > Attached patch includes the fix for ExecParallelHashTableInsert() as > > well as a test. I toyed with adapting one of the existing parallel full > > hash join tests to cover this

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Thomas Munro
On Thu, Apr 13, 2023 at 9:48 AM Melanie Plageman wrote: > Attached patch includes the fix for ExecParallelHashTableInsert() as > well as a test. I toyed with adapting one of the existing parallel full > hash join tests to cover this case, however, I think Richard's repro is > much more clear. Mayb

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Melanie Plageman
On Wed, Apr 12, 2023 at 2:59 PM Melanie Plageman wrote: > > On Wed, Apr 12, 2023 at 2:14 PM Andres Freund wrote: > > > > Hi, > > > > On 2023-04-12 10:57:17 -0400, Melanie Plageman wrote: > > > HeapTupleHeaderHasMatch() checks if HEAP_TUPLE_HAS_MATCH is set. > > > > > > In htup_details.h, you will

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Melanie Plageman
On Wed, Apr 12, 2023 at 2:14 PM Andres Freund wrote: > > Hi, > > On 2023-04-12 10:57:17 -0400, Melanie Plageman wrote: > > HeapTupleHeaderHasMatch() checks if HEAP_TUPLE_HAS_MATCH is set. > > > > In htup_details.h, you will see that HEAP_TUPLE_HAS_MATCH is defined as > > HEAP_ONLY_TUPLE > > /* > >

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Andres Freund
Hi, On 2023-04-12 10:57:17 -0400, Melanie Plageman wrote: > HeapTupleHeaderHasMatch() checks if HEAP_TUPLE_HAS_MATCH is set. > > In htup_details.h, you will see that HEAP_TUPLE_HAS_MATCH is defined as > HEAP_ONLY_TUPLE > /* > * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It

Re: Wrong results from Parallel Hash Full Join

2023-04-12 Thread Melanie Plageman
On Wed, Apr 12, 2023 at 7:36 AM Richard Guo wrote: > > I came across $subject and reduced the repro query as below. > > create table a (i int); > create table b (i int); > insert into a values (1); > insert into b values (2); > update b set i = 2; > > set min_parallel_table_scan_size to 0; > set p

Wrong results from Parallel Hash Full Join

2023-04-12 Thread Richard Guo
I came across $subject and reduced the repro query as below. create table a (i int); create table b (i int); insert into a values (1); insert into b values (2); update b set i = 2; set min_parallel_table_scan_size to 0; set parallel_tuple_cost to 0; set parallel_setup_cost to 0; # explain (costs