Re: How to force subquery scan?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)ee>
Cc: ch(at)rodos(dot)fzk(dot)de, pgsql-sql(at)postgresql(dot)org
Subject: Re: How to force subquery scan?
Date: 2005-03-16 15:41:52
Message-ID: 6303.1110987712@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Moran.Michael 2005-03-16 15:45:36 PGCrypto with Integers and DATE types -- how to?
Previous Message Tambet Matiisen 2005-03-16 15:13:22 Re: Parameterized views proposition