diff options
| author | David Rowley | 2023-10-05 08:03:10 +0000 |
|---|---|---|
| committer | David Rowley | 2023-10-05 08:03:10 +0000 |
| commit | a8a968a8212ee3ef7f22795c834b33d871fac262 (patch) | |
| tree | f5e16eb7247a6472cb7e81a7ec9ff7507fc29e1f /src/test | |
| parent | 0b053e78b5990cd01e7169ee5bd2bb8e4045deea (diff) | |
Consider cheap startup paths in add_paths_to_append_rel
6b94e7a6d did this for ordered append paths to allow fast startup
MergeAppends, however, nothing was done for the Append case.
Here we adjust add_paths_to_append_rel() to have it build an AppendPath
containing the cheapest startup paths from each of the child relations
when the append rel has "consider_startup" set.
Author: Andy Fan, David Rowley
Discussion: https://www.postgresql.org/message-id/CAKU4AWrXSkUV=Pt-gRxQT7EbfUeNssprGyNsB=5mJibFZ6S3ww@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/union.out | 21 | ||||
| -rw-r--r-- | src/test/regress/sql/union.sql | 11 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/regress/expected/union.out b/src/test/regress/expected/union.out index e2613d6777e..f046e522dea 100644 --- a/src/test/regress/expected/union.out +++ b/src/test/regress/expected/union.out @@ -1432,3 +1432,24 @@ where (x = 0) or (q1 >= q2 and q1 <= q2); 4567890123456789 | 4567890123456789 | 1 (6 rows) +-- +-- Test the planner's ability to produce cheap startup plans with Append nodes +-- +-- Ensure we get a Nested Loop join between tenk1 and tenk2 +explain (costs off) +select t1.unique1 from tenk1 t1 +inner join tenk2 t2 on t1.tenthous = t2.tenthous + union all +(values(1)) limit 1; + QUERY PLAN +-------------------------------------------------------- + Limit + -> Append + -> Nested Loop + Join Filter: (t1.tenthous = t2.tenthous) + -> Seq Scan on tenk1 t1 + -> Materialize + -> Seq Scan on tenk2 t2 + -> Result +(8 rows) + diff --git a/src/test/regress/sql/union.sql b/src/test/regress/sql/union.sql index ca8c9b4d128..d65ca9f86de 100644 --- a/src/test/regress/sql/union.sql +++ b/src/test/regress/sql/union.sql @@ -540,3 +540,14 @@ select * from union all select *, 1 as x from int8_tbl b) ss where (x = 0) or (q1 >= q2 and q1 <= q2); + +-- +-- Test the planner's ability to produce cheap startup plans with Append nodes +-- + +-- Ensure we get a Nested Loop join between tenk1 and tenk2 +explain (costs off) +select t1.unique1 from tenk1 t1 +inner join tenk2 t2 on t1.tenthous = t2.tenthous + union all +(values(1)) limit 1;
\ No newline at end of file |
