pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Rostron <mrostron@ql2.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: what does "initplan" operation in explain output mean?
Date: Sun, 01 Aug 2010 10:08:26 -0400
Message-ID: <4572.1280671706@sss.pgh.pa.us> (raw)
In-Reply-To: <FD020D3E50E7FA479567872E5F5F31E30459D622B0@ex01.corp.ql2.com>
References: <FD020D3E50E7FA479567872E5F5F31E30459D622B0@ex01.corp.ql2.com>

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



view thread (5+ messages)  latest in thread

Message-ID: <4572.1280671706@sss.pgh.pa.us>
Permalink:  ../4572.1280671706@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4572.1280671706@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mrostron@ql2.com
  Subject: Re: what does "initplan" operation in explain output mean?
  In-Reply-To: <4572.1280671706@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox