X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5703F5353A for ; Wed, 6 Apr 2005 18:14:47 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28761-02 for ; Wed, 6 Apr 2005 17:14:43 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id D729453245 for ; Wed, 6 Apr 2005 18:14:42 +0100 (BST) Received: (qmail 20048 invoked by uid 500); 6 Apr 2005 17:31:37 -0000 Date: Wed, 6 Apr 2005 12:31:37 -0500 From: Bruno Wolff III To: Ricardo =?iso-8859-1?Q?Valen=E7a?= de Assis Cc: pgsql-admin@postgresql.org Subject: Re: delete to slow Message-ID: <20050406173137.GA19739@wolff.to> Mail-Followup-To: Bruno Wolff III , Ricardo =?iso-8859-1?Q?Valen=E7a?= de Assis , pgsql-admin@postgresql.org References: <006701c53ac8$014b27e0$1b00280a@ugf.br> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <006701c53ac8$014b27e0$1b00280a@ugf.br> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/77 X-Sequence-Number: 17090 On Wed, Apr 06, 2005 at 13:45:13 -0300, Ricardo Valença de Assis 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;