Re: How to optimize this query ? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: How to optimize this query ?
Date
Msg-id 20030827181401.K85397-100000@megazone.bigpanda.com
Whole thread Raw
In response to How to optimize this query ?  (proghome@silesky.com (krystoffff))
List pgsql-sql
On Wed, 27 Aug 2003, ProgHome wrote:

> You were right, Stephan !
> The query below is still not correct ... because the second line
> shouldn't be shown !
> Now I really don't know how I could rewrite this without a subquery
> because it doesn't seem to be possible with some LEFT or INNER joins !
> Do you have an idea ?

The only ways I can think of are through a subquery (*) or possibly there
might be a way to do it with EXCEPT, but on first blush that seems like it
might be difficult and probably not any better speed wise.

(*) - You were using IN (subquery) which is known to be poorly optimized
for 7.3 and earlier.  You might want to see how it performs on your data
under 7.4beta for forward looking, and/or consider converting into a form
using EXISTS rather than IN.





pgsql-sql by date:

Previous
From: Joe Conway
Date:
Subject: Re: How to return a record set from function.
Next
From: Joe Conway
Date:
Subject: Re: length of array