pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Ricardo Valença de Assis <valenca@campusvirtual.br>
Cc: pgsql-admin@postgresql.org
Subject: Re: delete to slow
Date: Wed, 6 Apr 2005 12:31:37 -0500
Message-ID: <20050406173137.GA19739@wolff.to> (raw)
In-Reply-To: <006701c53ac8$014b27e0$1b00280a@ugf.br>
References: <006701c53ac8$014b27e0$1b00280a@ugf.br>

On Wed, Apr 06, 2005 at 13:45:13 -0300,
  Ricardo Valença de Assis <valenca@campusvirtual.br> wrote:
> Hello Everybody!
> 
>     I´m trying to use delete to remove data from one table based on another. The query is this:
> 
>     DELETE FROM table1 WHERE column1 IN (SELECT column2 FROM table2);
> 
>     but my table is big, so it takes a lot o time...
>     Is there a way to use DELETE with INNER JOIN in PostGreSQL?

Yes. You should be able to do something like:
DELETE FROM table1 WHERE column1 = table2.column2;



view thread (18+ messages)  latest in thread

Message-ID: <20050406173137.GA19739@wolff.to>
Permalink:  ../20050406173137.GA19739@wolff.to/
Also on:    postgresql.org/message-id/20050406173137.GA19739@wolff.to

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: bruno@wolff.to, valenca@campusvirtual.br
  Subject: Re: delete to slow
  In-Reply-To: <20050406173137.GA19739@wolff.to>
  References: <006701c53ac8$014b27e0$1b00280a@ugf.br> <20050406173137.GA19739@wolff.to>

* 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