Re: Pull up aggregate subquery

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Hitoshi Harada <umi.tanuki@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-05-25T16:20:44Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Make NestLoop plan nodes pass outer-relation variables into their inner

On Wed, May 25, 2011 at 10:35 AM, Hitoshi Harada <umi.tanuki@gmail.com> wrote:
> 2011/5/25 Hitoshi Harada <umi.tanuki@gmail.com>:
>> So I'm still
>> thinking which of pulling up and parameterized scan is better.
>
> After more investigation I came up with third idea, pushing down
> RangeTblEntry to aggregate subquery. This sounds like a crazy idea,
> but it seems to me like it is slightly easier than pulling up
> agg-subquery. The main point is that when you want to pull up, you
> must care if the final output would be correct with other join
> relations than the aggregate-related one. In contrast, when pushing
> down the target relation to agg-subquery it is simple to ensure the
> result.
>
> I'm looking around pull_up_subqueries() in subquery_planner() to add
> the pushing down logic. It could be possible to do it around
> make_one_rel() but I bet query structure changes are doable against
> Query, not PlannerInfo.

How do you decide whether or not to push down?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company