On Sat, Sep 26, 2015 at 5:54 AM, Robert Haas <robertmh...@gmail.com> wrote:
> On Fri, Sep 25, 2015 at 12:55 AM, Amit Kapila <amit.kapil...@gmail.com>
> > Yes, the patch needs more work in terms of dealing with
> > expressions/functions.  One idea which I have explored previously is
> > push down only safe clauses to workers (via partialseqscan node) and
> > execute restricted clauses in master (via Funnel node).  My analysis
> > is as follows:
> >
> > Usage of restricted functions in quals-
> > During create_plan() phase, separate out the quals that needs to be
> > executed at funnel node versus quals that needs to be executed on
> > partial seq scan node (do something similar to what is done in
> > create_indexscan_plan for index and non-index quals).
> >
> > Basically PartialSeqScan node can contain two different list of quals,
> > one for non-restrictive quals and other for restrictive quals and then
> > Funnel node can retrieve restrictive quals from partialseqscan node,
> > assuming partialseqscan node is its left child.
> >
> > Now, I think the above can only be possible under the assumption that
> > partialseqscan node is always a left child of funnel node, however that
> > not true because a gating node (Result node) can be added between the
> > two and tomorrow there could be more cases when other nodes will be
> > added between the two, if we consider the case of aggregation, the
> > situation will be more complex as before partial aggregation, all the
> > quals should be executed.
> What's the situation where the gating Result node sneaks in there?

The plan node structure will be something like
Funnel->Result->PartialSeqScan.  Both Result and PartialSeqScan are left
children in this structure.  Assuming at PartialSeqScan node, we have
identified the separate lists of Restrictive and Safe clauses (while forming
PartialSeqScan node, we can go through each of the clause and separate
out the safe and restrictive clause list with logic similar to what we
follow in
create_indexscan_plan().  here we need to be careful that if there is an OR
condition between restrictive and safe expression, both the expressions
be executed at funnel node.), we need to propagate that information to
node while creating funnel plan.  In this case, while forming Funnel plan
we need to traverse the left children and if there is any node (in this case
PartialSeqScan node) which has restrictive clauses, we need to pull those to
Funnel node.  So, the situation is that we need to traverse the whole plan
and pull up the restrictive clauses from the nodes (which contain
them) beneath
Funnel node.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Reply via email to