Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5DBFA1C0B196 for ; Fri, 20 Jul 2012 05:18:04 -0300 (ADT) Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ss8PS-0005it-PG for pgsql-sql@postgresql.org; Fri, 20 Jul 2012 08:18:04 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ss8PA-0000B9-Dv for pgsql-sql@postgresql.org; Fri, 20 Jul 2012 10:17:44 +0200 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Jul 2012 10:17:44 +0200 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Jul 2012 10:17:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: DELETE using an outer join Date: Fri, 20 Jul 2012 10:17:27 +0200 Lines: 18 Message-ID: References: <21289.1342709554@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <21289.1342709554@sss.pgh.pa.us> X-Pg-Spam-Score: -0.7 (/) X-Archive-Number: 201207/22 X-Sequence-Number: 36759 Tom Lane, 19.07.2012 16:52: > If you're using a reasonably recent version of PG, replacing the NOT IN > by a NOT EXISTS test should also help. Thanks. I wasn't aware of that (and the NOT EXISTS does indeed produce the same plan as the OUTER JOIN solution) >> Now I was wondering if a DELETE statement could be rewritten with the same "strategy": > > Not at the moment. There have been discussions of allowing the same > table name to be respecified in USING, but there are complications. Thanks as well. It's not a big deal for me. I was just curious if I missed something. Regards Thomas