Skip site navigation (1) Skip section navigation (2)

pgsql-server: When using extended-query protocol, postpone planning of

From: tgl(at)svr1(dot)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql-server: When using extended-query protocol, postpone planning of
Date: 2004-06-11 01:09:29
Message-ID: 20040611010929.53A6BD1B377@svr1.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
When using extended-query protocol, postpone planning of unnamed statements
until Bind is received, so that actual parameter values are visible to the
planner.  Make use of the parameter values for estimation purposes (but
don't fold them into the actual plan).  This buys back most of the
potential loss of plan quality that ensues from using out-of-line
parameters instead of putting literal values right into the query text.

This patch creates a notion of constant-folding expressions 'for
estimation purposes only', in which case we can be more aggressive than
the normal eval_const_expressions() logic can be.  Right now the only
difference in behavior is inserting bound values for Params, but it will
be interesting to look at other possibilities.  One that we've seen
come up repeatedly is reducing now() and related functions to current
values, so that queries like ... WHERE timestampcol > now() - '1 day'
have some chance of being planned effectively.

Oliver Jowett, with some kibitzing from Tom Lane.

Modified Files:
--------------
    pgsql-server/doc/src/sgml:
        protocol.sgml (r1.51 -> r1.52)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/protocol.sgml.diff?r1=1.51&r2=1.52)
    pgsql-server/src/backend/commands:
        explain.c (r1.121 -> r1.122)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/explain.c.diff?r1=1.121&r2=1.122)
        portalcmds.c (r1.27 -> r1.28)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/portalcmds.c.diff?r1=1.27&r2=1.28)
        prepare.c (r1.27 -> r1.28)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/prepare.c.diff?r1=1.27&r2=1.28)
    pgsql-server/src/backend/executor:
        functions.c (r1.81 -> r1.82)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/executor/functions.c.diff?r1=1.81&r2=1.82)
        spi.c (r1.117 -> r1.118)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/executor/spi.c.diff?r1=1.117&r2=1.118)
    pgsql-server/src/backend/optimizer/path:
        clausesel.c (r1.67 -> r1.68)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/clausesel.c.diff?r1=1.67&r2=1.68)
    pgsql-server/src/backend/optimizer/plan:
        planner.c (r1.171 -> r1.172)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/plan/planner.c.diff?r1=1.171&r2=1.172)
    pgsql-server/src/backend/optimizer/util:
        clauses.c (r1.175 -> r1.176)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/util/clauses.c.diff?r1=1.175&r2=1.176)
    pgsql-server/src/backend/tcop:
        postgres.c (r1.419 -> r1.420)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/tcop/postgres.c.diff?r1=1.419&r2=1.420)
    pgsql-server/src/backend/utils/adt:
        selfuncs.c (r1.160 -> r1.161)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/selfuncs.c.diff?r1=1.160&r2=1.161)
    pgsql-server/src/include/optimizer:
        clauses.h (r1.73 -> r1.74)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/optimizer/clauses.h.diff?r1=1.73&r2=1.74)
        planner.h (r1.28 -> r1.29)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/optimizer/planner.h.diff?r1=1.28&r2=1.29)
    pgsql-server/src/include/tcop:
        tcopprot.h (r1.66 -> r1.67)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/tcop/tcopprot.h.diff?r1=1.66&r2=1.67)

pgsql-committers by date

Next:From: Christopher Kings-LynneDate: 2004-06-11 01:13:15
Subject: Re: pgsql-server: Fix oversight in recent ALTER TABLE
Previous:From: Bruce MomjianDate: 2004-06-11 00:57:27
Subject: pgsql-server: More restructuring to use Win32 START with paths needing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group