-- Ensure that the generation expressions are wrapped into PHVs if needed
explain (verbose, costs off)
select t2.* from gtest32 t1 left join gtest32 t2 on false;
- QUERY PLAN
-------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------
Nested Loop Left Join
- Output: a, (a * 2), (20), (COALESCE(a, 100)), e
+ Output: t2.a, (t2.a * 2), (20), (COALESCE(t2.a, 100)), t2.e
Join Filter: false
-> Seq Scan on generated_virtual_tests.gtest32 t1
Output: t1.a, t1.b, t1.c, t1.d, t1.e
-> Result
- Output: a, e, 20, COALESCE(a, 100)
+ Output: t2.a, t2.e, 20, COALESCE(t2.a, 100)
One-Time Filter: false
Replaces: Scan on t2
(9 rows)
QUERY PLAN
----------------------------------------------------------
Nested Loop Left Join
- Output: t1.i, (1), t2.i2, i3, t4.i4
+ Output: t1.i, (1), t2.i2, t3.i3, t4.i4
-> Nested Loop Left Join
- Output: t1.i, t2.i2, (1), i3
+ Output: t1.i, t2.i2, (1), t3.i3
Join Filter: false
-> Hash Left Join
Output: t1.i, t2.i2, (1)
-> Seq Scan on pg_temp.t t2
Output: t2.i2, 1
-> Result
- Output: i3
+ Output: t3.i3
One-Time Filter: false
+ Replaces: Scan on t3
-> Memoize
Output: t4.i4
Cache Key: (1)
-> Index Only Scan using t_pkey on pg_temp.t t4
Output: t4.i4
Index Cond: (t4.i4 > (1))
-(25 rows)
+(26 rows)
explain (verbose, costs off)
select * from
QUERY PLAN
--------------------------------------------
Hash Left Join
- Hash Cond: (t1.q1 = q1)
+ Hash Cond: (t1.q1 = t2.q1)
-> Seq Scan on int8_tbl t1
-> Hash
-> Result
QUERY PLAN
--------------------------------------------
Hash Left Join
- Hash Cond: (t1.q1 = q1)
+ Hash Cond: (t1.q1 = t2.q1)
-> Seq Scan on int8_tbl t1
-> Hash
-> Result
QUERY PLAN
------------------------------------------------------
Nested Loop Left Join
- Output: q2
+ Output: int8_tbl.q2
Join Filter: NULL::boolean
Filter: (('constant'::text) >= ('constant'::text))
-> Seq Scan on public.int4_tbl
Output: int4_tbl.f1
-> Result
- Output: q2, 'constant'::text
+ Output: int8_tbl.q2, 'constant'::text
One-Time Filter: false
Replaces: Scan on int8_tbl
(10 rows)
--------------------------
Result
One-Time Filter: false
- Replaces: Scan on sj_1
+ Replaces: Scan on sj
(3 rows)
-- We can't use a cross-EC generated self join qual because of current logic of
explain (verbose, costs off)
select * from int8_tbl i8 left join lateral
(select *, i8.q2 from int4_tbl where false) ss on true;
- QUERY PLAN
---------------------------------------
+ QUERY PLAN
+----------------------------------------------
Nested Loop Left Join
- Output: i8.q1, i8.q2, f1, (i8.q2)
+ Output: i8.q1, i8.q2, int4_tbl.f1, (i8.q2)
Join Filter: false
-> Seq Scan on public.int8_tbl i8
Output: i8.q1, i8.q2
-> Result
- Output: f1, i8.q2
+ Output: int4_tbl.f1, i8.q2
One-Time Filter: false
Replaces: Scan on int4_tbl
(9 rows)
explain (verbose, costs off)
select * from int8_tbl i8 left join lateral
(select *, i8.q2 from int4_tbl i1, int4_tbl i2 where false) ss on true;
- QUERY PLAN
------------------------------------------
+ QUERY PLAN
+-----------------------------------------------
Nested Loop Left Join
- Output: i8.q1, i8.q2, f1, f1, (i8.q2)
+ Output: i8.q1, i8.q2, i1.f1, i2.f1, (i8.q2)
-> Seq Scan on public.int8_tbl i8
Output: i8.q1, i8.q2
-> Result
- Output: f1, f1, i8.q2
+ Output: i1.f1, i2.f1, i8.q2
One-Time Filter: false
Replaces: Join on i1, i2
(8 rows)
QUERY PLAN
--------------------------------------------------
Hash Left Join
- Hash Cond: (t2.b = a)
+ Hash Cond: (t2.b = prt1.a)
-> Append
-> Hash Join
Hash Cond: (t3_1.a = t2_1.b)
QUERY PLAN
--------------------------------------------
Sort
- Sort Key: a, t2.b
+ Sort Key: prt1.a, t2.b
-> Hash Left Join
- Hash Cond: (t2.b = a)
+ Hash Cond: (t2.b = prt1.a)
-> Append
-> Seq Scan on prt2_p1 t2_1
Filter: (a = 0)
-- join with one side empty
EXPLAIN (COSTS OFF)
SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE a = 1 AND a = 2) t1 RIGHT JOIN prt2_l t2 ON t1.a = t2.b AND t1.b = t2.a AND t1.c = t2.c;
- QUERY PLAN
--------------------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------------------------
Hash Left Join
- Hash Cond: ((t2.b = a) AND (t2.a = b) AND ((t2.c)::text = (c)::text))
+ Hash Cond: ((t2.b = prt1_l.a) AND (t2.a = prt1_l.b) AND ((t2.c)::text = (prt1_l.c)::text))
-> Append
-> Seq Scan on prt2_l_p1 t2_1
-> Seq Scan on prt2_l_p2_p1 t2_2