@@ -2781,16 +2781,17 @@ select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800
2781
2781
-- Unshippable HAVING clause will be evaluated locally, and other qual in HAVING clause is pushed down
2782
2782
explain (verbose, costs off)
2783
2783
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;
2784
- QUERY PLAN
2785
- ---------------------------------------------------------------------------------------------------------------------------------------
2784
+ QUERY PLAN
2785
+ ---------------------------------------------------------------------------------------------------------------------------------------------
2786
2786
Aggregate
2787
2787
Output: count(*)
2788
- -> Foreign Scan
2789
- Output: ft1.c5, NULL::bigint, (sqrt((ft1.c2)::double precision))
2790
- Filter: (((((avg(ft1.c1)) / (avg(ft1.c1))))::double precision * random()) <= '1'::double precision)
2791
- Relations: Aggregate on (public.ft1)
2792
- Remote SQL: SELECT c5, NULL::bigint, sqrt(c2), avg("C 1") FROM "S 1"."T 1" GROUP BY 1, 3 HAVING ((avg("C 1") < 500::numeric))
2793
- (7 rows)
2788
+ -> Subquery Scan on x
2789
+ -> Foreign Scan
2790
+ Output: ft1.c5, NULL::bigint, (sqrt((ft1.c2)::double precision))
2791
+ Filter: (((((avg(ft1.c1)) / (avg(ft1.c1))))::double precision * random()) <= '1'::double precision)
2792
+ Relations: Aggregate on (public.ft1)
2793
+ Remote SQL: SELECT c5, NULL::bigint, sqrt(c2), avg("C 1") FROM "S 1"."T 1" GROUP BY 1, 3 HAVING ((avg("C 1") < 500::numeric))
2794
+ (8 rows)
2794
2795
2795
2796
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;
2796
2797
count
0 commit comments