Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 80E426328B9 for ; Sun, 1 Aug 2010 11:08:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 04183-07 for ; Sun, 1 Aug 2010 14:08:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 4C45C63226D for ; Sun, 1 Aug 2010 11:08:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o71E8QF9004573; Sun, 1 Aug 2010 10:08:26 -0400 (EDT) To: Mark Rostron cc: "pgsql-performance@postgresql.org" Subject: Re: what does "initplan" operation in explain output mean? In-reply-to: References: Comments: In-reply-to Mark Rostron message dated "Sat, 31 Jul 2010 23:36:37 -0700" Date: Sun, 01 Aug 2010 10:08:26 -0400 Message-ID: <4572.1280671706@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/2 X-Sequence-Number: 39845 Mark Rostron 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