Re: How to optimize this query ?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: ProgHome <proghome(at)silesky(dot)com>
Cc: 'Franco Bruno Borghesi' <franco(at)akyasociados(dot)com(dot)ar>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to optimize this query ?
Date: 2003-08-28 01:18:39
Message-ID: 20030827181401.K85397-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-08-28 03:19:22 Re: [OT?]*_fsm_* parameters in postgresql.conf: which versions supports them?
Previous Message Joe Conway 2003-08-28 01:02:38 Re: How to return a record set from function.