pgsql: Add a concept of "placeholder" variables to the planner.

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Add a concept of "placeholder" variables to the planner.
Дата
Msg-id 20081021204254.04ACB7545A4@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Add a concept of "placeholder" variables to the planner.  These are variables
that represent some expression that we desire to compute below the top level
of the plan, and then let that value "bubble up" as though it were a plain
Var (ie, a column value).

The immediate application is to allow sub-selects to be flattened even when
they are below an outer join and have non-nullable output expressions.
Formerly we couldn't flatten because such an expression wouldn't properly
go to NULL when evaluated above the outer join.  Now, we wrap it in a
PlaceHolderVar and arrange for the actual evaluation to occur below the outer
join.  When the resulting Var bubbles up through the join, it will be set to
NULL if necessary, yielding the correct results.  This fixes a planner
limitation that's existed since 7.1.

In future we might want to use this mechanism to re-introduce some form of
Hellerstein's "expensive functions" optimization, ie place the evaluation of
an expensive function at the most suitable point in the plan tree.

Modified Files:
--------------
    pgsql/src/backend/nodes:
        copyfuncs.c (r1.408 -> r1.409)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.408&r2=1.409)
        equalfuncs.c (r1.333 -> r1.334)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.333&r2=1.334)
        nodeFuncs.c (r1.34 -> r1.35)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/nodeFuncs.c?r1=1.34&r2=1.35)
        outfuncs.c (r1.342 -> r1.343)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.342&r2=1.343)
    pgsql/src/backend/optimizer/path:
        allpaths.c (r1.174 -> r1.175)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/allpaths.c?r1=1.174&r2=1.175)
        costsize.c (r1.199 -> r1.200)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/costsize.c?r1=1.199&r2=1.200)
        equivclass.c (r1.12 -> r1.13)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/equivclass.c?r1=1.12&r2=1.13)
    pgsql/src/backend/optimizer/plan:
        createplan.c (r1.250 -> r1.251)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/createplan.c?r1=1.250&r2=1.251)
        initsplan.c (r1.142 -> r1.143)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.142&r2=1.143)
        planmain.c (r1.110 -> r1.111)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planmain.c?r1=1.110&r2=1.111)
        planner.c (r1.244 -> r1.245)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.244&r2=1.245)
        setrefs.c (r1.145 -> r1.146)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/setrefs.c?r1=1.145&r2=1.146)
        subselect.c (r1.141 -> r1.142)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c?r1=1.141&r2=1.142)
    pgsql/src/backend/optimizer/prep:
        prepjointree.c (r1.56 -> r1.57)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepjointree.c?r1=1.56&r2=1.57)
        preptlist.c (r1.91 -> r1.92)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/preptlist.c?r1=1.91&r2=1.92)
        prepunion.c (r1.158 -> r1.159)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c?r1=1.158&r2=1.159)
    pgsql/src/backend/optimizer/util:
        Makefile (r1.18 -> r1.19)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/Makefile?r1=1.18&r2=1.19)
        clauses.c (r1.269 -> r1.270)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/clauses.c?r1=1.269&r2=1.270)
        relnode.c (r1.91 -> r1.92)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/relnode.c?r1=1.91&r2=1.92)
        tlist.c (r1.82 -> r1.83)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/tlist.c?r1=1.82&r2=1.83)
        var.c (r1.80 -> r1.81)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/var.c?r1=1.80&r2=1.81)
    pgsql/src/backend/rewrite:
        rewriteManip.c (r1.115 -> r1.116)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteManip.c?r1=1.115&r2=1.116)
    pgsql/src/backend/utils/adt:
        selfuncs.c (r1.255 -> r1.256)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/selfuncs.c?r1=1.255&r2=1.256)
    pgsql/src/include/nodes:
        nodes.h (r1.213 -> r1.214)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/nodes.h?r1=1.213&r2=1.214)
        relation.h (r1.161 -> r1.162)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.161&r2=1.162)
    pgsql/src/include/optimizer:
        var.h (r1.38 -> r1.39)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/var.h?r1=1.38&r2=1.39)

Added Files:
-----------
    pgsql/src/backend/optimizer/util:
        placeholder.c (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/placeholder.c?rev=1.1&content-type=text/x-cvsweb-markup)
    pgsql/src/include/optimizer:
        placeholder.h (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/placeholder.h?rev=1.1&content-type=text/x-cvsweb-markup)

В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] pgsql: SQL 200N -> SQL:2003
Следующее
От: petere@postgresql.org (Peter Eisentraut)
Дата:
Сообщение: pgsql: SQL:2008 alternative syntax for LIMIT/OFFSET: OFFSET num