Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmYlp-0005H4-BH for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2023 11:36:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pmYln-0001qt-Ou for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2023 11:36:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmYln-0001qk-FM for pgsql-hackers@lists.postgresql.org; Wed, 12 Apr 2023 11:36:11 +0000 Received: from mail-yw1-x112c.google.com ([2607:f8b0:4864:20::112c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pmYlh-0008BW-2F for pgsql-hackers@postgresql.org; Wed, 12 Apr 2023 11:36:10 +0000 Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-54c12009c30so320337957b3.9 for ; Wed, 12 Apr 2023 04:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681299364; x=1683891364; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=7QmhnB70ypnONz7dK5pImNfsiS+7+Bg+oh4NKvCxiYQ=; b=rISn2KmjwqbDipIvO6lsBOOLqgeJX43uXKTtNq4JRl6RAPu0tzt82NVQDXP52vwxHu fa6MwDE98f8vBssVkvf4cs1mkjHENg2I7V3ef80WX/YhxP2M8/G1Z2tGn250QJ7k/Lsf IK+iZmXq0w0nIzDizpTx/QTDYzsJ51D40CEKwbCKI76Sbot+T2rI8DJA7gz+QYI0/btm m4Vh4Asr5H8TcP/PkYF0KIQgh6FF4rrGbTrz/n+zh4kXRq4dPopItIZ9saY5IpBcidO3 5i7GI8C58WpoP+UJ/BAXqX1EmOaxSH6v10fVHkteXIcov8cCVrwwGrfYJNGHZwmIK4Je BLXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681299364; x=1683891364; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7QmhnB70ypnONz7dK5pImNfsiS+7+Bg+oh4NKvCxiYQ=; b=urGlAKxkBu6VS8Ux7JFy6eMlQOUsRTOORG1NsicsM1loI725YvYsusjkfAxSutHMio pcZdpafFDz3sKpwVkWAv4DGfJOHvcLrGcaX9BniwCGHuBGEp9w4XJ2Bg3+GS9ygwml/S G8vzqnyfcMGWGAQS6PgaIfQn0bYQ2sn1SDud2lFMoMiKJ1RZXKzMdIKL9rFb3+8cQK4D RPMTVn7wVAMY/LKclVlbMjVl3pMiOW/znjFVUnxm7cXERLSiDeBj9M3TXbxzjE6iLlbc cxBqhi2XGocAIqTvdBD8bGSrY0XqNuLQKmySiL8wyghI23gvnFOgquj0SZ2IZgEPlL/W gY4A== X-Gm-Message-State: AAQBX9dWSqQpy1WUfxPGfQPatmu3K15DK+MIe6Yzlp/waahmDWfdtGca WbSq2x3Tatsd+CSfN1RUz5mwiJv//KxpmqZBWIndLuK6Bv4= X-Google-Smtp-Source: AKy350YkIzNauKdj6zKpvC7WI2r/EMt5s0nBAmFFKkzb2kvRILu+WTdyWxVr6/NSeZAIQ0hbDAOAqz+C7rM7/JzwLec= X-Received: by 2002:a81:bc48:0:b0:54f:a609:e88 with SMTP id b8-20020a81bc48000000b0054fa6090e88mr579900ywl.7.1681299364000; Wed, 12 Apr 2023 04:36:04 -0700 (PDT) MIME-Version: 1.0 From: Richard Guo Date: Wed, 12 Apr 2023 19:35:53 +0800 Message-ID: Subject: Wrong results from Parallel Hash Full Join To: PostgreSQL-development Content-Type: multipart/alternative; boundary="0000000000005a391e05f9220315" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005a391e05f9220315 Content-Type: text/plain; charset="UTF-8" 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 off) select * from a full join b on a.i = b.i; QUERY PLAN ------------------------------------------ Gather Workers Planned: 2 -> Parallel Hash Full Join Hash Cond: (a.i = b.i) -> Parallel Seq Scan on a -> Parallel Hash -> Parallel Seq Scan on b (7 rows) # select * from a full join b on a.i = b.i; i | i ---+--- 1 | (1 row) Tuple (NULL, 2) is missing from the results. Thanks Richard --0000000000005a391e05f9220315 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I came across $subject and reduced the repro query as belo= w.

create table a (i int);
create table b (i int);
insert into= a values (1);
insert into b values (2);
update b set i =3D 2;
set min_parallel_table_scan_size to 0;
set parallel_tuple_cost to 0;set parallel_setup_cost to 0;

# explain (costs off) select * from a= full join b on a.i =3D b.i;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 QUERY PLAN
------------------------------------------
= =C2=A0Gather
=C2=A0 =C2=A0Workers Planned: 2
=C2=A0 =C2=A0-> =C2= =A0Parallel Hash Full Join
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Hash Cond: = (a.i =3D b.i)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-> =C2=A0Parallel Seq= Scan on a
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-> =C2=A0Parallel Hash=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-> =C2=A0Parall= el Seq Scan on b
(7 rows)

# select * from a full join b on a.i = =3D b.i;
=C2=A0i | i
---+---
=C2=A01 |
(1 row)

Tuple (NU= LL, 2) is missing from the results.

Thanks
Richard
--0000000000005a391e05f9220315--