Re: Partial aggregates pushdown - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Partial aggregates pushdown
Date
Msg-id CA+TgmobQeKf0-z0gMEiMB90yToRrhy0f8dO8G19qFsX78vqxRw@mail.gmail.com
Whole thread Raw
In response to Re: Partial aggregates pushdown  (Alexander Pyhalov <a.pyhalov@postgrespro.ru>)
List pgsql-hackers
On Wed, Nov 22, 2023 at 1:32 AM Alexander Pyhalov
<a.pyhalov@postgrespro.ru> wrote:
> Hi. HAVING is also a problem. Consider the following query
>
> SELECT count(a) FROM t HAVING count(a) > 10 - we can't push it down to
> foreign server as HAVING needs full aggregate result, but foreign server
> don't know it.

I don't see it that way. What we would push to the foreign server
would be something like SELECT count(a) FROM t. Then, after we get the
results back and combine the various partial counts locally, we would
locally evaluate the HAVING clause afterward. That is, partial
aggregation is a barrier to pushing down HAVING clause itself, but it
doesn't preclude pushing down the aggregation.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Jeremy Schneider
Date:
Subject: proposal: change behavior on collation version mismatch
Next
From: Nathan Bossart
Date:
Subject: Re: Do away with a few backwards compatibility macros