Re: what does "initplan" operation in explain output mean?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Rostron <mrostron(at)ql2(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: what does "initplan" operation in explain output mean?
Date: 2010-08-01 14:08:26
Message-ID: 4572.1280671706@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Rostron <mrostron(at)ql2(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2010-08-02 14:26:39 Re: Testing Sandforce SSD
Previous Message Mark Rostron 2010-08-01 06:36:37 what does "initplan" operation in explain output mean?