Обсуждение: WIP patch to add "placeholder" variables to planner

Поиск
Список
Период
Сортировка

WIP patch to add "placeholder" variables to planner

От
Tom Lane
Дата:
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


Вложения