Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad13a09

Browse files
committed
postgres_fdw: Attempt to stabilize regression results.
Set enable_hashagg to false for tests involving least_agg(), so thatwe get the same plan regardless of local costing variances. Also,remove a test involving sqrt(); it's there to test deparsing ofHAVING clauses containing expressions, but that's tested elsewhereanyway, and sqrt(2) deparses with different amounts of precision ondifferent machines.Per buildfarm.
1 parent7aa2c10 commitad13a09

File tree

2 files changed

+25
-58
lines changed

2 files changed

+25
-58
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 21 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,35 +2491,6 @@ select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800
24912491
2 | 49700
24922492
(2 rows)
24932493

2494-
-- Using expressions in HAVING clause
2495-
explain (verbose, costs off)
2496-
select c5, count(c2) from ft1 group by c5, sqrt(c2) having sqrt(max(c2)) = sqrt(2) order by 1, 2;
2497-
QUERY PLAN
2498-
--------------------------------------------------------------------------------------------------------------------------------------------------------------
2499-
Sort
2500-
Output: c5, (count(c2)), (sqrt((c2)::double precision))
2501-
Sort Key: ft1.c5, (count(ft1.c2))
2502-
-> Foreign Scan
2503-
Output: c5, (count(c2)), (sqrt((c2)::double precision))
2504-
Relations: Aggregate on (public.ft1)
2505-
Remote SQL: SELECT c5, count(c2), sqrt(c2) FROM "S 1"."T 1" GROUP BY c5, (sqrt(c2)) HAVING ((sqrt(max(c2)) = 1.41421356237309515::double precision))
2506-
(7 rows)
2507-
2508-
select c5, count(c2) from ft1 group by c5, sqrt(c2) having sqrt(max(c2)) = sqrt(2) order by 1, 2;
2509-
c5 | count
2510-
--------------------------+-------
2511-
Sat Jan 03 00:00:00 1970 | 10
2512-
Tue Jan 13 00:00:00 1970 | 10
2513-
Fri Jan 23 00:00:00 1970 | 10
2514-
Mon Feb 02 00:00:00 1970 | 10
2515-
Thu Feb 12 00:00:00 1970 | 10
2516-
Sun Feb 22 00:00:00 1970 | 10
2517-
Wed Mar 04 00:00:00 1970 | 10
2518-
Sat Mar 14 00:00:00 1970 | 10
2519-
Tue Mar 24 00:00:00 1970 | 10
2520-
Fri Apr 03 00:00:00 1970 | 10
2521-
(10 rows)
2522-
25232494
-- Unshippable HAVING clause will be evaluated locally, and other qual in HAVING clause is pushed down
25242495
explain (verbose, costs off)
25252496
select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having (avg(c1) / avg(c1)) * random() <= 1 and avg(c1) < 500) x;
@@ -2844,21 +2815,20 @@ returns anyelement language sql as
28442815
create aggregate least_agg(variadic items anyarray) (
28452816
stype = anyelement, sfunc = least_accum
28462817
);
2818+
-- Disable hash aggregation for plan stability.
2819+
set enable_hashagg to false;
28472820
-- Not pushed down due to user defined aggregate
28482821
explain (verbose, costs off)
28492822
select c2, least_agg(c1) from ft1 group by c2 order by c2;
2850-
QUERY PLAN
2851-
-------------------------------------------------------------
2852-
Sort
2853-
Output: c2, (least_agg(VARIADIC ARRAY[c1]))
2854-
Sort Key: ft1.c2
2855-
-> HashAggregate
2856-
Output: c2, least_agg(VARIADIC ARRAY[c1])
2857-
Group Key: ft1.c2
2858-
-> Foreign Scan on public.ft1
2859-
Output: c2, c1
2860-
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
2861-
(9 rows)
2823+
QUERY PLAN
2824+
----------------------------------------------------------------------------------
2825+
GroupAggregate
2826+
Output: c2, least_agg(VARIADIC ARRAY[c1])
2827+
Group Key: ft1.c2
2828+
-> Foreign Scan on public.ft1
2829+
Output: c2, c1
2830+
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" ORDER BY c2 ASC NULLS LAST
2831+
(6 rows)
28622832

28632833
-- Add function and aggregate into extension
28642834
alter extension postgres_fdw add function least_accum(anyelement, variadic anyarray);
@@ -2900,20 +2870,18 @@ alter server loopback options (set extensions 'postgres_fdw');
29002870
-- Not pushed down as we have dropped objects from extension.
29012871
explain (verbose, costs off)
29022872
select c2, least_agg(c1) from ft1 group by c2 order by c2;
2903-
QUERY PLAN
2904-
-------------------------------------------------------------
2905-
Sort
2906-
Output: c2, (least_agg(VARIADIC ARRAY[c1]))
2907-
Sort Key: ft1.c2
2908-
-> HashAggregate
2909-
Output: c2, least_agg(VARIADIC ARRAY[c1])
2910-
Group Key: ft1.c2
2911-
-> Foreign Scan on public.ft1
2912-
Output: c2, c1
2913-
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
2914-
(9 rows)
2873+
QUERY PLAN
2874+
----------------------------------------------------------------------------------
2875+
GroupAggregate
2876+
Output: c2, least_agg(VARIADIC ARRAY[c1])
2877+
Group Key: ft1.c2
2878+
-> Foreign Scan on public.ft1
2879+
Output: c2, c1
2880+
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" ORDER BY c2 ASC NULLS LAST
2881+
(6 rows)
29152882

29162883
-- Cleanup
2884+
reset enable_hashagg;
29172885
drop aggregate least_agg(variadic items anyarray);
29182886
drop function least_accum(anyelement, variadic anyarray);
29192887
-- Testing USING OPERATOR() in ORDER BY within aggregate.

‎contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,6 @@ explain (verbose, costs off)
593593
select c2,sum(c1)from ft2group by c2havingavg(c1)<500andsum(c1)<49800order by c2;
594594
select c2,sum(c1)from ft2group by c2havingavg(c1)<500andsum(c1)<49800order by c2;
595595

596-
-- Using expressions in HAVING clause
597-
explain (verbose, costs off)
598-
select c5,count(c2)from ft1group by c5, sqrt(c2)having sqrt(max(c2))= sqrt(2)order by1,2;
599-
select c5,count(c2)from ft1group by c5, sqrt(c2)having sqrt(max(c2))= sqrt(2)order by1,2;
600-
601596
-- Unshippable HAVING clause will be evaluated locally, and other qual in HAVING clause is pushed down
602597
explain (verbose, costs off)
603598
selectcount(*)from (select c5,count(c1)from ft1group by c5, sqrt(c2)having (avg(c1)/avg(c1))* random()<=1andavg(c1)<500) x;
@@ -677,6 +672,9 @@ create aggregate least_agg(variadic items anyarray) (
677672
stype= anyelement, sfunc= least_accum
678673
);
679674

675+
-- Disable hash aggregation for plan stability.
676+
set enable_hashagg to false;
677+
680678
-- Not pushed down due to user defined aggregate
681679
explain (verbose, costs off)
682680
select c2, least_agg(c1)from ft1group by c2order by c2;
@@ -701,6 +699,7 @@ explain (verbose, costs off)
701699
select c2, least_agg(c1)from ft1group by c2order by c2;
702700

703701
-- Cleanup
702+
reset enable_hashagg;
704703
dropaggregate least_agg(variadic items anyarray);
705704
dropfunction least_accum(anyelement, variadic anyarray);
706705

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp