X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A107FDB77A for ; Mon, 14 Nov 2005 19:20:24 -0400 (AST) 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 11371-03 for ; Mon, 14 Nov 2005 23:20:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 400C6DA720 for ; Mon, 14 Nov 2005 19:20:20 -0400 (AST) Received: by calvin.slamb.org (Postfix, from userid 103) id AC5436FD1F; Mon, 14 Nov 2005 17:20:23 -0600 (CST) Received: from [IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id 6FE3D6FCA2; Mon, 14 Nov 2005 17:20:22 -0600 (CST) In-Reply-To: <43790A99.9050603@noao.edu> References: <43790A99.9050603@noao.edu> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> Cc: Postgres-performance Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Help speeding up delete Date: Mon, 14 Nov 2005 15:20:21 -0800 To: Steve Wampler X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/228 X-Sequence-Number: 15485 On Nov 14, 2005, at 2:07 PM, Steve Wampler wrote: > # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a > # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; Isn't this equivalent? select id from tmp_table2 where name = 'obsid' and value = 'oid080505'; > # DELETE FROM "tmp_table2" WHERE id IN > # (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a > # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'); and this? delete from tmp_table2 where name = 'obsid' and value = 'oid080505'; Why are you doing a self-join using id, which I assume is a primary key? -- Scott Lamb