diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-05 15:24:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-05 15:24:36 -0400 |
commit | ff8fa0bf7eb9001f321c2af4bbe9c0f2bd5c1bf8 (patch) | |
tree | 7cadb5dc4c18bee125ac600864bf7c2c5bbd9fa5 /src/test/regress/expected/join.out | |
parent | c3652cd84ac8aa60dd09a9743d4db6f20e985a2f (diff) | |
download | postgresql-ff8fa0bf7eb9001f321c2af4bbe9c0f2bd5c1bf8.tar.gz |
Handle SubPlan cases in find_nonnullable_rels/vars.
We can use some variants of SubPlan to deduce that Vars appearing
in the testexpr must be non-null.
Richard Guo
Discussion: https://postgr.es/m/CAMbWs4-jV=199A2Y_6==99dYnpnmaO_Wz_RGkRTTaCB=Pihw2w@mail.gmail.com
Diffstat (limited to 'src/test/regress/expected/join.out')
-rw-r--r-- | src/test/regress/expected/join.out | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index b901d7299f..9358371072 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -4651,6 +4651,34 @@ select a.q2, b.q1 reset enable_hashjoin; reset enable_nestloop; -- +-- test join strength reduction with a SubPlan providing the proof +-- +explain (costs off) +select a.unique1, b.unique2 + from onek a left join onek b on a.unique1 = b.unique2 + where b.unique2 = any (select q1 from int8_tbl c where c.q1 < b.unique1); + QUERY PLAN +---------------------------------------------------------- + Hash Join + Hash Cond: (b.unique2 = a.unique1) + -> Seq Scan on onek b + Filter: (SubPlan 1) + SubPlan 1 + -> Seq Scan on int8_tbl c + Filter: (q1 < b.unique1) + -> Hash + -> Index Only Scan using onek_unique1 on onek a +(9 rows) + +select a.unique1, b.unique2 + from onek a left join onek b on a.unique1 = b.unique2 + where b.unique2 = any (select q1 from int8_tbl c where c.q1 < b.unique1); + unique1 | unique2 +---------+--------- + 123 | 123 +(1 row) + +-- -- test join removal -- begin; |