WIP patch to add "placeholder" variables to planner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: WIP patch to add "placeholder" variables to planner
Date: 2008-10-20 20:38:12
Message-ID: 3327.1224535092@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Per earlier discussion,
http://archives.postgresql.org/pgsql-hackers/2008-10/msg00853.php
I've been fooling around with a patch to let the planner evaluate
some expressions at lower join levels and bubble the results up
like Vars. I've got it passing the regression tests now, and though
there is more left to do I thought it'd be worth posting for comment.

One thing I'm not totally satisfied with is that I've got each instance
of a PlaceHolderVar carrying a copy of the represented expression.
This seems a bit inefficient, but it's difficult to get rid of it
without making things a lot more fragile. There are a lot of properties
of an expression tree (for example, whether it contains any volatile
functions) that are currently extracted on-demand using recursive tree
walkers. So we'd need walkers to be able to descend through a
PlaceHolderVar in any case, and once you buy into that it's hard to
not say the same for mutators, so there can't just be a single shared
copy of the expression. The only significant drawback I've found is
that if the expression contains a sub-SELECT you end up with some
useless extra copies of the resulting subplan. Which is annoying but
it isn't really going to cost anything at runtime, and the case seems
unlikely to occur much in practice anyhow.

Comments anyone?

regards, tom lane

Attachment Content-Type Size
placeholders-1.patch.gz application/octet-stream 20.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2008-10-20 20:39:23 Re: [HACKERS] Hot Standby utility and administrator functions
Previous Message Tom Lane 2008-10-20 20:22:59 Re: Patch status for reducing de-TOAST overhead?