2011/5/5 Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>:
> I'll work further if I find time.
After more thought, pulling up aggregate subquery in narrow
conditional cases is quite hard path, especially when the joinrel is
more than 2. It will be hard to check pulling up is safe for other
relations than the target relation.
It was a big shame I missed Tom Lane's session in PGCon, but finding
"Parameterized Scan" in his slides, it occurred to me that it might
help my problem, too. Before hitting the "pull up" idea, I once
thought if it would be possible to push outer Var of join down to
Agg's HAVING, which is transferred to underlying SeqScan's filter.
Resulted in something like:
-> SeqScan M (filter: M.val = '1')
-> SeqScan M (filter: L.m_id = M.id)
However, currently we don't have such mechanism to push down Var as a
qual to non-NestLoop. Yeah, it could be even now, but we should avoid
N-loop of Agg. We want to scan Agg once, with Param $1 = M.id =
multiple values. Since I didn't attend his session I'm afraid I don't
understand "Parameterized Scan" correctly, but once we've got such
mechanism, one example introduced in Robert Haas's blog (originally
shown by Andrew Gierth) and LATERAL maybe.
Do I understand correctly? If so, could someone explain more detail of
how to get Parameterized Scan in the planner?
In response to
pgsql-hackers by date
|Next:||From: Heikki Linnakangas||Date: 2011-05-21 18:54:37|
|Subject: Re: Memory leak in FDW|
|Previous:||From: Alvaro Herrera||Date: 2011-05-21 16:13:50|
|Subject: Re: eviscerating the parser|