Re: using CustomScan to inject nodes into the plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: using CustomScan to inject nodes into the plan
Date: 2015-03-11 20:53:43
Message-ID: 10102.1426107223@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
> I've been experimenting with using CustomScan to inject nodes into the
> plan - I'm experimenting a bit, and this seemed like a nice way to do
> that in an extension, outside the tree.

> Sadly set_rel_pathlist_hook is not flexible enough, because it only
> allows overriding paths for base relations, while I'd like to inject
> nodes above joins, for example, so instead of

It's Custom*Scan*, not Custom-anything-you-want. It's only supposed
to exist at the bottom level of the plan tree, and that's why it does
not have fields that would allow using it somewhere else. Quite aside
from the scanrelid thing, haven't you noticed that it lacks any link to
child plan nodes?

I'm not terribly on board with this whole concept of adding plan nodes
from extensions; I do not believe that that approach will ever lead to
anything except horrid kluges, bad planning decisions, and requests for
ever-more-outre hooks to shift the kluginess somewhere else. But as
Robert says, the custom join thing is more likely to be usable for this,
and it would be interesting to hear just how bad the impedance mismatch
is if you try that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-03-11 20:57:42 Re: Strange assertion using VACOPT_FREEZE in vacuum.c
Previous Message Jim Nasby 2015-03-11 20:49:04 Re: proposal: searching in array function - array_position