pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Llew <postgres@lg.ndirect.co.uk>
To: pgsql-sql@postgresql.org
Subject: Re: where not exists
Date: Wed, 06 Mar 2002 12:25:30 -0800
Message-ID: <web-819049@davinci.ethosmedia.com> (raw)
In-Reply-To: <a65qji$2i6k$1@jupiter.hub.org>

Llew,

Do it all in one query:

> DELETE FROM a
>         WHERE NOT EXISTS
>         (
>             SELECT b.join1
>                 FROM b
>                 WHERE
>                 a.join1 = b.join1 AND
>                 a.join2 = b.join2
>         )

And make sure that join1 and join2 are indexed in both tables.

-Josh Berkus



view thread (7+ messages)  latest in thread

Message-ID: <web-819049@davinci.ethosmedia.com>
Permalink:  ../web-819049@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-819049@davinci.ethosmedia.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: josh@agliodbs.com, postgres@lg.ndirect.co.uk
  Subject: Re: where not exists
  In-Reply-To: <web-819049@davinci.ethosmedia.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