@@ -12413,27 +12413,28 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
1241312413 from tcorr2
1241412414 where tcorr2.b = out.b
1241512415 group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
12416- QUERY PLAN
12417- ----------------------------------------------------------------------------------------------------------------------
12416+ QUERY PLAN
12417+ ----------------------------------------------------------------------------------------------------------------------------
1241812418 Nested Loop Semi Join (cost=10000000001.08..10000000003.20 rows=3 width=8)
12419- Join Filter: ("out".b = COALESCE((count(*)), '99'::bigint))
1242012419 -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.03 rows=1 width=8)
1242112420 -> Seq Scan on tcorr1 "out" (cost=0.00..1.01 rows=1 width=8)
1242212421 -> Materialize (cost=1.08..2.17 rows=3 width=8)
1242312422 -> Hash Left Join (cost=1.08..2.15 rows=3 width=8)
12424- Hash Cond: (tcorr1.a = tcorr2.a)
12423+ Hash Cond: (tcorr1.a = tcorr2_d.a)
12424+ Filter: ("out".b = COALESCE(tcorr2_d.c, '99'::bigint))
1242512425 -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..1.03 rows=1 width=4)
1242612426 -> Seq Scan on tcorr1 (cost=0.00..1.01 rows=1 width=4)
1242712427 -> Hash (cost=1.07..1.07 rows=1 width=12)
12428- -> HashAggregate (cost=1.05..1.06 rows=1 width=12)
12429- Group Key: tcorr2.a
12430- -> Result (cost=0.00..1.04 rows=1 width=4)
12431- Filter: (tcorr2.b = "out".b)
12432- -> Materialize (cost=0.00..1.03 rows=1 width=8)
12433- -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1.03 rows=1 width=8)
12434- -> Seq Scan on tcorr2 (cost=0.00..1.01 rows=1 width=8)
12428+ -> Subquery Scan on tcorr2_d (cost=1.05..1.07 rows=1 width=12)
12429+ -> HashAggregate (cost=1.05..1.06 rows=1 width=12)
12430+ Group Key: tcorr2.a
12431+ -> Result (cost=0.00..1.04 rows=1 width=4)
12432+ Filter: (tcorr2.b = "out".b)
12433+ -> Materialize (cost=0.00..1.03 rows=1 width=8)
12434+ -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1.03 rows=1 width=8)
12435+ -> Seq Scan on tcorr2 (cost=0.00..1.01 rows=1 width=8)
1243512436 Optimizer: Postgres query optimizer
12436- (18 rows)
12437+ (19 rows)
1243712438
1243812439-- expect 1 row
1243912440select *
@@ -12534,27 +12535,28 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
1253412535 from tcorr2
1253512536 where tcorr2.b = out.b
1253612537 group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
12537- QUERY PLAN
12538- ----------------------------------------------------------------------------------------------------------------------
12538+ QUERY PLAN
12539+ ----------------------------------------------------------------------------------------------------------------------------
1253912540 Nested Loop Semi Join (cost=10000000001.08..10000000003.20 rows=3 width=8)
12540- Join Filter: ("out".b = COALESCE((count(*)), '99'::bigint))
1254112541 -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.03 rows=1 width=8)
1254212542 -> Seq Scan on tcorr1 "out" (cost=0.00..1.01 rows=1 width=8)
1254312543 -> Materialize (cost=1.08..2.17 rows=3 width=8)
1254412544 -> Hash Left Join (cost=1.08..2.15 rows=3 width=8)
12545- Hash Cond: (tcorr1.a = tcorr2.a)
12545+ Hash Cond: (tcorr1.a = tcorr2_d.a)
12546+ Filter: ("out".b = COALESCE(tcorr2_d.c, '99'::bigint))
1254612547 -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..1.03 rows=1 width=4)
1254712548 -> Seq Scan on tcorr1 (cost=0.00..1.01 rows=1 width=4)
1254812549 -> Hash (cost=1.07..1.07 rows=1 width=12)
12549- -> HashAggregate (cost=1.05..1.06 rows=1 width=12)
12550- Group Key: tcorr2.a
12551- -> Result (cost=0.00..1.04 rows=1 width=4)
12552- Filter: (tcorr2.b = "out".b)
12553- -> Materialize (cost=0.00..1.03 rows=1 width=8)
12554- -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1.03 rows=1 width=8)
12555- -> Seq Scan on tcorr2 (cost=0.00..1.01 rows=1 width=8)
12550+ -> Subquery Scan on tcorr2_d (cost=1.05..1.07 rows=1 width=12)
12551+ -> HashAggregate (cost=1.05..1.06 rows=1 width=12)
12552+ Group Key: tcorr2.a
12553+ -> Result (cost=0.00..1.04 rows=1 width=4)
12554+ Filter: (tcorr2.b = "out".b)
12555+ -> Materialize (cost=0.00..1.03 rows=1 width=8)
12556+ -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1.03 rows=1 width=8)
12557+ -> Seq Scan on tcorr2 (cost=0.00..1.01 rows=1 width=8)
1255612558 Optimizer: Postgres query optimizer
12557- (18 rows)
12559+ (19 rows)
1255812560
1255912561-- expect 1 row
1256012562select *
@@ -13040,7 +13042,7 @@ from foo l1 where b in (select ab
1304013042 -> Redistribute Motion 3:3 (slice2; segments: 3)
1304113043 Hash Key: (RowIdExpr)
1304213044 -> Nested Loop
13043- Join Filter: ((l1.a + tbtree.b) = l1.b )
13045+ Join Filter: (l1.b = (l1.a + tbtree.b))
1304413046 -> Broadcast Motion 3:3 (slice3; segments: 3)
1304513047 -> Seq Scan on foo l1
1304613048 -> Materialize
@@ -13333,34 +13335,32 @@ from asset_records left join coverage
1333313335 and asset_records.active
1333413336where upper(coalesce(vendor, 'none')::text) <> 'some_vendor' and vendor_sla is not null
1333513337group by asset_records.uid, asset_records.hostname, asset_records.asset_type, asset_records.os, asset_records.create_ts;
13336- QUERY PLAN
13337- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
13338+ QUERY PLAN
13339+ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1333813340 Gather Motion 3:1 (slice1; segments: 3)
13339- -> GroupAggregate
13341+ -> HashAggregate
1334013342 Group Key: asset_records.uid, asset_records.hostname, asset_records.asset_type, asset_records.os, asset_records.create_ts
13341- -> Sort
13342- Sort Key: asset_records.uid, asset_records.hostname, asset_records.asset_type, asset_records.os, asset_records.create_ts
13343- -> Redistribute Motion 3:3 (slice2; segments: 3)
13344- Hash Key: asset_records.uid, asset_records.hostname, asset_records.asset_type, asset_records.os, asset_records.create_ts
13345- -> Hash Join
13346- Hash Cond: ((upper((coverage.hostname)::text) = upper((asset_records.hostname)::text)) AND (coverage.date = asset_records.create_ts))
13347- -> Seq Scan on coverage
13348- Filter: (vendor_sla IS NOT NULL)
13349- -> Hash
13350- -> Broadcast Motion 3:3 (slice3; segments: 3)
13351- -> Append
13352- -> Seq Scan on asset_records_1_prt_1 asset_records_1
13353- Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13354- -> Seq Scan on asset_records_1_prt_2 asset_records_2
13355- Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13356- -> Seq Scan on asset_records_1_prt_3 asset_records_3
13357- Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13358- -> Seq Scan on asset_records_1_prt_4 asset_records_4
13359- Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13360- -> Seq Scan on asset_records_1_prt_5 asset_records_5
13361- Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13343+ -> Redistribute Motion 3:3 (slice2; segments: 3)
13344+ Hash Key: asset_records.uid, asset_records.hostname, asset_records.asset_type, asset_records.os, asset_records.create_ts
13345+ -> Hash Join
13346+ Hash Cond: ((upper((coverage.hostname)::text) = upper((asset_records.hostname)::text)) AND (coverage.date = asset_records.create_ts))
13347+ -> Seq Scan on coverage
13348+ Filter: (vendor_sla IS NOT NULL)
13349+ -> Hash
13350+ -> Broadcast Motion 3:3 (slice3; segments: 3)
13351+ -> Append
13352+ -> Seq Scan on asset_records_1_prt_1 asset_records_1
13353+ Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13354+ -> Seq Scan on asset_records_1_prt_2 asset_records_2
13355+ Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13356+ -> Seq Scan on asset_records_1_prt_3 asset_records_3
13357+ Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13358+ -> Seq Scan on asset_records_1_prt_4 asset_records_4
13359+ Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
13360+ -> Seq Scan on asset_records_1_prt_5 asset_records_5
13361+ Filter: (active AND (((asset_type)::text = 'xx'::text) OR ((asset_type)::text = 'yy'::text)) AND (upper((COALESCE(vendor, 'none'::character varying))::text) <> 'some_vendor'::text))
1336213362 Optimizer: Postgres query optimizer
13363- (25 rows)
13363+ (23 rows)
1336413364
1336513365-- IndexApply-PartResolverExpand.mdp
1336613366-- from comment
@@ -13642,7 +13642,7 @@ ORDER BY to_char(order_datetime,'YYYY-Q')
1364213642 -> GroupAggregate
1364313643 Group Key: (to_char(order_lineitems.order_datetime, 'YYYY-Q'::text)), order_lineitems.item_shipment_status_code
1364413644 -> Sort
13645- Sort Key: (to_char(order_lineitems.order_datetime, 'YYYY-Q'::text)), order_lineitems.item_shipment_status_code
13645+ Sort Key: (to_char(order_lineitems.order_datetime, 'YYYY-Q'::text)), order_lineitems.item_shipment_status_code, order_lineitems.order_id
1364613646 -> Redistribute Motion 3:3 (slice2; segments: 3)
1364713647 Hash Key: (to_char(order_lineitems.order_datetime, 'YYYY-Q'::text)), order_lineitems.item_shipment_status_code
1364813648 -> Append
0 commit comments