Thread: pgsql: If a LIMIT is applied to a UNION ALL query, plan each UNION arm

pgsql: If a LIMIT is applied to a UNION ALL query, plan each UNION arm

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
If a LIMIT is applied to a UNION ALL query, plan each UNION arm as
if the limit were directly applied to it.  This does not actually
add a LIMIT plan node to the generated subqueries --- that would be
useless overhead --- but it does cause the planner to prefer fast-
start plans when the limit is small.  After an idea from Phil Endecott.

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        planner.c (r1.188 -> r1.189)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c.diff?r1=1.188&r2=1.189)
    pgsql/src/backend/optimizer/prep:
        prepunion.c (r1.123 -> r1.124)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c.diff?r1=1.123&r2=1.124)
    pgsql/src/include/optimizer:
        prep.h (r1.50 -> r1.51)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/prep.h.diff?r1=1.50&r2=1.51)