As per previous discussions, something I want to do for 9.1 is generalize
the notion of "inner indexscan" so that nestloop joins can pass parameters
down more than one level before they reach the scan where they're needed.
To do that, we've got to get rid of the current ad-hoc mechanism that
passes the nestloop's outer tuple to the ReScan function of the inner
indexscan. Instead, we can use the executor's general-purpose PARAM_EXEC
Attached is a WIP patch that implements this first step. It compiles and
passes regression tests, but there are a couple of loose ends yet:
* I haven't actually removed the second parameter of ExecReScan and
subsidiary routines. That will enlarge the patch quite a bit without
making much difference for reviewing or performance testing, so I left
it out of this version.
* EXPLAIN now prints the passed-in values as $0, $1, etc, which is a
considerable step backwards in plan readability. I have some ideas on
fixing that, but haven't tried to do anything about it yet.
I believe that the patch is approximately a wash for performance in
its current form: there's a bit of extra work in nodeNestloop.c to
extract values from the current outer tuple, but that should be largely
bought back during the uses of the values in the inner scan, because
ExecEvalParam is cheaper than ExecEvalVar. I haven't tried to demonstrate
that by performance testing, though.
Any comments? Anyone want to test it before it gets committed?
regards, tom lane