From: | Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> |
---|---|
To: | "Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp" <Fujii(dot)Yuki(at)df(dot)mitsubishielectric(dot)co(dot)jp> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, vignesh C <vignesh21(at)gmail(dot)com> |
Subject: | Re: Partial aggregates pushdown |
Date: | 2024-05-28 05:45:04 |
Message-ID: | d15cb3cb52ffa5f49cf78596eecba04d@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp писал(а) 2024-05-28 00:30:
> Hi Mr. Pyhalov.
>
Hi.
>> Found one more problem. You can fire partial aggregate over
>> partitioned
>> table, but convert_combining_aggrefs() will make non-partial copy,
>> which
>> leads to
>> 'variable not found in subplan target list' error.
> Thanks for the correction as well.
> As you pointed out,
> the original patch certainly had the potential to cause problems.
> However, I could not actually reproduce the problem in cases such as
> the following.
>
> Settings:
> t(c1, c2) is a patitioned table whose partition key is c1.
> t1, t2 are patitions of t and are partitioned table.
> t11, t12: partitions of t1 and foreign table of postgres_fdw.
> t21, t22: partitions of t2 and foreign table of postgres_fdw.
> Query:
> select c2 / 2, sum(c1) from t group by c2 / 2 order by 1
>
> If you have a reproducible example, I would like to add it to
> the regression test.
> Do you have a reproducible example?
>
The fix was to set child_agg->agg_partial to orig_agg->agg_partial in
convert_combining_aggrefs(), it's already in the patch,
as well as the example - without this fix
-- Check partial aggregate over partitioned table
EXPLAIN (VERBOSE, COSTS OFF)
SELECT avg(PARTIAL_AGGREGATE a), avg(a) FROM pagg_tab;
fails with
ERROR: variable not found in subplan target list
--
Best regards,
Alexander Pyhalov,
Postgres Professional
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Pyhalov | 2024-05-28 05:57:39 | Re: Partial aggregates pushdown |
Previous Message | Pradeep Kumar | 2024-05-28 05:37:08 | Need clarification on compilation errors in PG 16.2 |