Обсуждение: pgsql: Fix up LIMIT/OFFSET planning so that we cope with non-constant

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

pgsql: Fix up LIMIT/OFFSET planning so that we cope with non-constant

От
tgl@svr1.postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
Fix up LIMIT/OFFSET planning so that we cope with non-constant LIMIT
or OFFSET clauses by using estimate_expression_value().  The main advantage
of this is that if the expression is a Param and we have a value for the
Param, we'll use that value rather than defaulting.  Also, fix some
thinkos in the logic for combining LIMIT/OFFSET with an externally
supplied tuple fraction (this covers cases like EXISTS(...LIMIT...)).
And make sure the results of all this are shown by EXPLAIN.  Per a
gripe from Merlin Moncure.

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        createplan.c (r1.196 -> r1.197)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/createplan.c.diff?r1=1.196&r2=1.197)
        planagg.c (r1.7 -> r1.8)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planagg.c.diff?r1=1.7&r2=1.8)
        planner.c (r1.190 -> r1.191)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c.diff?r1=1.190&r2=1.191)
    pgsql/src/include/optimizer:
        planmain.h (r1.86 -> r1.87)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/planmain.h.diff?r1=1.86&r2=1.87)