Re: what does "initplan" operation in explain output mean? - Mailing list pgsql-performance

From Tom Lane
Subject Re: what does "initplan" operation in explain output mean?
Date
Msg-id 4572.1280671706@sss.pgh.pa.us
Whole thread Raw
In response to what does "initplan" operation in explain output mean?  (Mark Rostron <mrostron@ql2.com>)
Responses Re: what does "initplan" operation in explain output mean?  (Mark Rostron <mrostron@ql2.com>)
List pgsql-performance
Mark Rostron <mrostron@ql2.com> writes:
> This message is a request for information about the "initplan" operation in explain plan.

An initplan is a sub-SELECT that only needs to be executed once because it
has no dependency on the immediately surrounding query level.  The cases
you show here are from sub-SELECTs like this:

    (select min(wu_id) from work_active limit 1)

which yields a value that's independent of anything in the outer query.
If there were an outer reference in there, you'd get a SubPlan instead,
because the subquery would need to be done over again for each row of
the outer query.

BTW, adding LIMIT 1 to an aggregate query is pretty pointless.

            regards, tom lane

pgsql-performance by date:

Previous
From: Mark Rostron
Date:
Subject: what does "initplan" operation in explain output mean?
Next
From: Merlin Moncure
Date:
Subject: Re: Testing Sandforce SSD