diff -U3 /tmp/cirrus-ci-build/src/test/regress/expected/tidrangescan.out /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/tidrangescan.out --- /tmp/cirrus-ci-build/src/test/regress/expected/tidrangescan.out 2024-09-07 23:40:51.054911233 +0000 +++ /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/tidrangescan.out 2024-09-07 23:47:36.760971827 +0000 @@ -315,15 +315,12 @@ -- parallel range scans with upper bound explain (costs off) select count(*) from parallel_tidrangescan where ctid<'(30,1)'; - QUERY PLAN --------------------------------------------------------------------- - Finalize Aggregate - -> Gather - Workers Planned: 4 - -> Partial Aggregate - -> Parallel Tid Range Scan on parallel_tidrangescan - TID Cond: (ctid < '(30,1)'::tid) -(6 rows) + QUERY PLAN +----------------------------------------------- + Aggregate + -> Tid Range Scan on parallel_tidrangescan + TID Cond: (ctid < '(30,1)'::tid) +(3 rows) select count(*) from parallel_tidrangescan where ctid<'(30,1)'; count @@ -334,15 +331,12 @@ -- parallel range scans with lower bound explain (costs off) select count(*) from parallel_tidrangescan where ctid>'(10,0)'; - QUERY PLAN --------------------------------------------------------------------- - Finalize Aggregate - -> Gather - Workers Planned: 4 - -> Partial Aggregate - -> Parallel Tid Range Scan on parallel_tidrangescan - TID Cond: (ctid > '(10,0)'::tid) -(6 rows) + QUERY PLAN +----------------------------------------------- + Aggregate + -> Tid Range Scan on parallel_tidrangescan + TID Cond: (ctid > '(10,0)'::tid) +(3 rows) select count(*) from parallel_tidrangescan where ctid>'(10,0)'; count @@ -353,15 +347,12 @@ -- parallel range scans with both bounds explain (costs off) select count(*) from parallel_tidrangescan where ctid>'(10,0)' and ctid<'(30,1)'; - QUERY PLAN ------------------------------------------------------------------------------------ - Finalize Aggregate - -> Gather - Workers Planned: 4 - -> Partial Aggregate - -> Parallel Tid Range Scan on parallel_tidrangescan - TID Cond: ((ctid > '(10,0)'::tid) AND (ctid < '(30,1)'::tid)) -(6 rows) + QUERY PLAN +----------------------------------------------------------------------- + Aggregate + -> Tid Range Scan on parallel_tidrangescan + TID Cond: ((ctid > '(10,0)'::tid) AND (ctid < '(30,1)'::tid)) +(3 rows) select count(*) from parallel_tidrangescan where ctid>'(10,0)' and ctid<'(30,1)'; count @@ -374,17 +365,15 @@ SELECT t.ctid,t2.c FROM parallel_tidrangescan t, LATERAL (SELECT count(*) c FROM parallel_tidrangescan t2 WHERE t2.ctid <= t.ctid) t2 WHERE t.ctid < '(1,0)'; - QUERY PLAN ----------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------- Nested Loop - -> Gather - Workers Planned: 4 - -> Parallel Tid Range Scan on parallel_tidrangescan t - TID Cond: (ctid < '(1,0)'::tid) + -> Tid Range Scan on parallel_tidrangescan t + TID Cond: (ctid < '(1,0)'::tid) -> Aggregate -> Tid Range Scan on parallel_tidrangescan t2 TID Cond: (ctid <= t.ctid) -(8 rows) +(6 rows) SELECT t.ctid,t2.c FROM parallel_tidrangescan t, LATERAL (SELECT count(*) c FROM parallel_tidrangescan t2 WHERE t2.ctid <= t.ctid) t2 diff -U3 /tmp/cirrus-ci-build/src/test/regress/expected/incremental_sort.out /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/incremental_sort.out --- /tmp/cirrus-ci-build/src/test/regress/expected/incremental_sort.out 2024-09-07 23:40:50.994930238 +0000 +++ /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/incremental_sort.out 2024-09-07 23:47:37.172971044 +0000 @@ -1450,27 +1450,29 @@ set enable_incremental_sort = on; explain (costs off) select a,b,sum(c) from t group by 1,2 order by 1,2,3 limit 1; - QUERY PLAN ----------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Limit -> Incremental Sort Sort Key: a, b, (sum(c)) Presorted Key: a, b - -> GroupAggregate + -> Finalize GroupAggregate Group Key: a, b -> Gather Merge Workers Planned: 2 - -> Incremental Sort - Sort Key: a, b - Presorted Key: a - -> Parallel Index Scan using t_a_idx on t -(12 rows) + -> Partial GroupAggregate + Group Key: a, b + -> Incremental Sort + Sort Key: a, b + Presorted Key: a + -> Parallel Index Scan using t_a_idx on t +(14 rows) -- Incremental sort vs. set operations with varno 0 set enable_hashagg to off; explain (costs off) select * from t union select * from t order by 1,3; - QUERY PLAN ----------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Incremental Sort Sort Key: t.a, t.c Presorted Key: t.a @@ -1479,29 +1481,32 @@ Sort Key: t.a, t.b, t.c -> Gather Merge Workers Planned: 2 - -> Sort + -> Incremental Sort Sort Key: t.a, t.b, t.c - -> Parallel Seq Scan on t + Presorted Key: t.a + -> Parallel Index Scan using t_a_idx on t -> Gather Merge Workers Planned: 2 - -> Sort + -> Incremental Sort Sort Key: t_1.a, t_1.b, t_1.c - -> Parallel Seq Scan on t t_1 -(16 rows) + Presorted Key: t_1.a + -> Parallel Index Scan using t_a_idx on t t_1 +(18 rows) -- Full sort, not just incremental sort can be pushed below a gather merge path -- by generate_useful_gather_paths. explain (costs off) select distinct a,b from t; - QUERY PLAN ------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------- Unique -> Gather Merge Workers Planned: 2 -> Unique - -> Sort + -> Incremental Sort Sort Key: a, b - -> Parallel Seq Scan on t -(7 rows) + Presorted Key: a + -> Parallel Index Scan using t_a_idx on t +(8 rows) drop table t; -- Sort pushdown can't go below where expressions are part of the rel target. diff -U3 /tmp/cirrus-ci-build/src/test/regress/expected/select_parallel.out /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/select_parallel.out --- /tmp/cirrus-ci-build/src/test/regress/expected/select_parallel.out 2024-09-07 23:40:51.042914993 +0000 +++ /tmp/cirrus-ci-build/src/bin/pg_upgrade/tmp_check/results/select_parallel.out 2024-09-07 23:47:45.064956105 +0000 @@ -1012,11 +1012,12 @@ --------------------------------------------------------------- Gather Merge Workers Planned: 4 - -> Sort + -> Incremental Sort Sort Key: hundred, (parallel_safe_volatile(thousand)) - -> Parallel Seq Scan on tenk1 + Presorted Key: hundred + -> Parallel Index Scan using tenk1_hundred on tenk1 Filter: (four = 2) -(6 rows) +(7 rows) -- Test gather merge atop of an incremental sort a of partial path set min_parallel_index_scan_size = 0;