WIP patch: pass outer-relation Vars as parameters to indexscans

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: WIP patch: pass outer-relation Vars as parameters to indexscans
Date: 2010-07-12 04:54:10
Message-ID: 16864.1278910450@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
mechanism.

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

Attachment Content-Type Size
indexscan-params-1.patch text/x-patch 55.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2010-07-12 04:58:12 Re: [v9.1] Add security hook on initialization of instance
Previous Message Itagaki Takahiro 2010-07-12 04:46:25 Re: multibyte charater set in levenshtein function