mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
postgres_fdw: Try again to stabilize aggregate pushdown regression tests.
A query that only aggregates one row isn't a great argument for pushdown, and buildfarm member brolga decides against it. Adjust the query a bit in the hopes of getting remote aggregation to win consistently. Jeevan Chalke, per suggestion from Tom Lane
This commit is contained in:
@ -3123,40 +3123,32 @@ select c2, sum from "S 1"."T 1" t1, lateral (select sum(t2.c1 + t1."C 1") sum fr
|
|||||||
reset enable_hashagg;
|
reset enable_hashagg;
|
||||||
-- Check with placeHolderVars
|
-- Check with placeHolderVars
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select q.b, count(ft4.c1), sum(q.a) from ft4 left join (select min(13), avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1) where ft1.c1 = 12) q(a, b, c) on (ft4.c1 = q.b) where ft4.c1 between 10 and 15 group by q.b order by 1 nulls last, 2;
|
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Sort
|
Aggregate
|
||||||
Output: q.b, (count(ft4.c1)), (sum(q.a))
|
Output: sum(q.a), count(q.b)
|
||||||
Sort Key: q.b, (count(ft4.c1))
|
-> Nested Loop Left Join
|
||||||
-> GroupAggregate
|
Output: q.a, q.b
|
||||||
Output: q.b, count(ft4.c1), sum(q.a)
|
Join Filter: ((ft4.c1)::numeric <= q.b)
|
||||||
Group Key: q.b
|
-> Foreign Scan on public.ft4
|
||||||
-> Sort
|
Output: ft4.c1, ft4.c2, ft4.c3
|
||||||
Output: q.b, ft4.c1, q.a
|
Remote SQL: SELECT c1 FROM "S 1"."T 3"
|
||||||
Sort Key: q.b
|
-> Materialize
|
||||||
-> Hash Left Join
|
Output: q.a, q.b
|
||||||
Output: q.b, ft4.c1, q.a
|
-> Subquery Scan on q
|
||||||
Hash Cond: ((ft4.c1)::numeric = q.b)
|
Output: q.a, q.b
|
||||||
-> Foreign Scan on public.ft4
|
-> Foreign Scan
|
||||||
Output: ft4.c1, ft4.c2, ft4.c3
|
Output: (13), (avg(ft1.c1)), (NULL::bigint)
|
||||||
Remote SQL: SELECT c1 FROM "S 1"."T 3" WHERE ((c1 >= 10)) AND ((c1 <= 15))
|
Relations: Aggregate on ((public.ft2) LEFT JOIN (public.ft1))
|
||||||
-> Hash
|
Remote SQL: SELECT 13, avg(r1."C 1"), NULL::bigint FROM ("S 1"."T 1" r2 LEFT JOIN "S 1"."T 1" r1 ON (((r1."C 1" = r2."C 1"))))
|
||||||
Output: q.b, q.a
|
(16 rows)
|
||||||
-> Subquery Scan on q
|
|
||||||
Output: q.b, q.a
|
|
||||||
-> Foreign Scan
|
|
||||||
Output: (min(13)), (avg(ft1.c1)), (NULL::bigint)
|
|
||||||
Relations: Aggregate on ((public.ft1) INNER JOIN (public.ft2))
|
|
||||||
Remote SQL: SELECT min(13), avg(r1."C 1"), NULL::bigint FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (((r2."C 1" = 12)) AND ((r1."C 1" = 12))))
|
|
||||||
(23 rows)
|
|
||||||
|
|
||||||
select q.b, count(ft4.c1), sum(q.a) from ft4 left join (select min(13), avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1) where ft1.c1 = 12) q(a, b, c) on (ft4.c1 = q.b) where ft4.c1 between 10 and 15 group by q.b order by 1 nulls last, 2;
|
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
|
||||||
b | count | sum
|
sum | count
|
||||||
---------------------+-------+-----
|
-----+-------
|
||||||
12.0000000000000000 | 1 | 13
|
650 | 50
|
||||||
| 2 |
|
(1 row)
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
-- Not supported cases
|
-- Not supported cases
|
||||||
-- Grouping sets
|
-- Grouping sets
|
||||||
|
@ -808,8 +808,8 @@ reset enable_hashagg;
|
|||||||
|
|
||||||
-- Check with placeHolderVars
|
-- Check with placeHolderVars
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select q.b, count(ft4.c1), sum(q.a) from ft4 left join (select min(13), avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1) where ft1.c1 = 12) q(a, b, c) on (ft4.c1 = q.b) where ft4.c1 between 10 and 15 group by q.b order by 1 nulls last, 2;
|
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
|
||||||
select q.b, count(ft4.c1), sum(q.a) from ft4 left join (select min(13), avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1) where ft1.c1 = 12) q(a, b, c) on (ft4.c1 = q.b) where ft4.c1 between 10 and 15 group by q.b order by 1 nulls last, 2;
|
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
|
||||||
|
|
||||||
|
|
||||||
-- Not supported cases
|
-- Not supported cases
|
||||||
|
Reference in New Issue
Block a user