Re: delete to slow

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ricardo Valença de Assis <valenca(at)campusvirtual(dot)br>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: delete to slow
Date: 2005-04-06 17:31:37
Message-ID: 20050406173137.GA19739@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Apr 06, 2005 at 13:45:13 -0300,
Ricardo Valença de Assis <valenca(at)campusvirtual(dot)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;

In response to

  • delete to slow at 2005-04-06 16:45:13 from Ricardo Valença de Assis

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ricardo Valença de Assis 2005-04-06 17:32:55 Re: delete to slow
Previous Message Tom Lane 2005-04-06 17:27:42 Re: delete to slow