Thread: pgsql: Fix cost estimates for EXISTS subqueries that are evaluated as

pgsql: Fix cost estimates for EXISTS subqueries that are evaluated as

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Fix cost estimates for EXISTS subqueries that are evaluated as initPlans
(because they are uncorrelated with the immediate parent query).  We were
charging the full run cost to the parent node, disregarding the fact that
only one row need be fetched for EXISTS.  While this would only be a
cosmetic issue in most cases, it might possibly affect planning outcomes
if the parent query were itself a subquery to some upper query.
Per recent discussion with Steve Crawford.

Modified Files:
--------------
    pgsql/src/backend/optimizer/path:
        costsize.c (r1.185 -> r1.186)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/costsize.c?r1=1.185&r2=1.186)
    pgsql/src/backend/optimizer/plan:
        subselect.c (r1.124 -> r1.125)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c?r1=1.124&r2=1.125)
    pgsql/src/include/optimizer:
        cost.h (r1.88 -> r1.89)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/cost.h?r1=1.88&r2=1.89)