Re: strange behaviour with sub-select and pl/pgSQL - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: strange behaviour with sub-select and pl/pgSQL
Date
Msg-id 20070301163043.GA1705@svana.org
Whole thread Raw
In response to strange behaviour with sub-select and pl/pgSQL  (Robert Partyka <rpartyka@wdg.pl>)
List pgsql-general
On Tue, Feb 27, 2007 at 12:15:03PM +0100, Robert Partyka wrote:
> Hi,
>
> I found PostgreSQL have strange behaviour with sub-select and pl/pgSQL,
> see the case study at:
> http://www.bobson.pl/pgsql/pgsql_sb1.html

The PostgreSQL optimiser is pretty smart and will pull up simple
sub-selects like yours. If you put your subselect into a view, you'd
also want the optimiser to find the optimal plan, right?

If you want to stop it pulling up the subquery, you can add an  OFFSET
0 or ORDER BY or anything that makes it a not-simple subquery.  That
tells the planner to leave it alone.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: mobiledreamers@gmail.com
Date:
Subject: Re: US Highschool database in postgres
Next
From: clark@knowideas.com
Date:
Subject: How Can I set a non standard date format?