Re: Help speeding up delete

From: Scott Lamb <slamb(at)slamb(dot)org>
To: Steve Wampler <swampler(at)noao(dot)edu>
Cc: Postgres-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Help speeding up delete
Date: 2005-11-14 23:20:21
Message-ID: 5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-www

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 <http://www.slamb.org/>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-11-14 23:42:43 Re: Help speeding up delete
Previous Message Steve Wampler 2005-11-14 22:07:21 Help speeding up delete

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2005-11-14 23:42:43 Re: Help speeding up delete
Previous Message Steve Wampler 2005-11-14 22:07:21 Help speeding up delete