pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: ProgHome <proghome@silesky.com>
Cc: Franco Bruno Borghesi <franco@akyasociados.com.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to optimize this query ?
Date: Wed, 27 Aug 2003 18:18:39 -0700 (PDT)
Message-ID: <20030827181401.K85397-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <037f01c36cff$ec09c770$0700a8c0@Office3>

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.






view thread (28+ messages)  latest in thread

Message-ID: <20030827181401.K85397-100000@megazone.bigpanda.com>
Permalink:  ../20030827181401.K85397-100000@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20030827181401.K85397-100000@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, proghome@silesky.com, franco@akyasociados.com.ar
  Subject: Re: How to optimize this query ?
  In-Reply-To: <20030827181401.K85397-100000@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox