From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Robert Partyka <rpartyka(at)wdg(dot)pl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: strange behaviour with sub-select and pl/pgSQL |
Date: | 2007-03-01 16:30:43 |
Message-ID: | 20070301163043.GA1705@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-03-01 16:31:56 | Re: postgres init script reports failure, but postmaster started |
Previous Message | Palle Girgensohn | 2007-03-01 16:30:05 | Re: /libexec/ld-elf.so.1: Shared object "libpq.so.4" not found |