| From: | Mark Rostron <mrostron(at)ql2(dot)com> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| 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-02 16:42:45 | 
| Message-ID: | FD020D3E50E7FA479567872E5F5F31E30459D62323@ex01.corp.ql2.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-performance | 
Thanks.
So am I right in assuming that the aggregate sub-query ( against work_active ) results will not assist with constraint exclusion in the sub-query against work_unit (if we introduce range partitions on this table)?
 Mr
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us] 
Sent: Sunday, August 01, 2010 7:08 AM
To: Mark Rostron
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] what does "initplan" operation in explain output mean? 
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2010-08-02 17:29:47 | Re: what does "initplan" operation in explain output mean? | 
| Previous Message | Yeb Havinga | 2010-08-02 15:00:27 | Re: Testing Sandforce SSD |