pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tambet Matiisen <t.matiisen@aprote.ee>
Cc: ch@rodos.fzk.de
Cc: pgsql-sql@postgresql.org
Subject: Re: How to force subquery scan?
Date: Wed, 16 Mar 2005 10:41:52 -0500
Message-ID: <6303.1110987712@sss.pgh.pa.us> (raw)
In-Reply-To: <A66A11DBF5525341AEF6B8DE39CDE770088058@black.aprote.com>
References: <A66A11DBF5525341AEF6B8DE39CDE770088058@black.aprote.com>

"Tambet Matiisen" <t.matiisen@aprote.ee> writes:
> It seems that subquery scan is only used, when the query can not be
> translated into single flat query. Which is mostly good, I assume.

The planner thinks so anyway ;-)

If you're desperate you can put in an optimization fence, for instance
LIMIT or OFFSET.

	SELECT * FROM (SELECT ... OFFSET 0) ss;

In principle the planner could figure out that this offset is a no-op,
throw it away, and then flatten the query.  But it doesn't at the
moment, and I doubt we'll teach it to do so in the future.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <6303.1110987712@sss.pgh.pa.us>
Permalink:  ../6303.1110987712@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6303.1110987712@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, t.matiisen@aprote.ee, ch@rodos.fzk.de
  Subject: Re: How to force subquery scan?
  In-Reply-To: <6303.1110987712@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