public inbox for [email protected]
help / color / mirror / Atom feedFrom: Steve Wampler <[email protected]>
To: Scott Lamb <[email protected]>
Cc: Postgres-performance <[email protected]>
Subject: Re: Help speeding up delete
Date: Mon, 14 Nov 2005 21:03:56 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
Scott Lamb wrote:
> On Nov 14, 2005, at 3:52 PM, Steve Wampler wrote:
>
>> Scott Lamb wrote:
>>
>>> 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';
>>
>>
>> Probably, the user based the above on a query designed to find
>> all rows with the same id as those rows that have a.name='obsid' and
>> a.value='oid080505'.
>
>
> Well, this indirection is only significant if those two sets can
> differ. If (A) you meant "tmp_table2" when you wrote "tmp_tabl2e", so
> this is a self-join, and (B) there is a primary key on "id", I don't
> think that can ever happen.
I wasn't clear. The original query was:
SELECT at.* FROM "tmp_table2" at, "tmp_table2" a
WHERE at.id=a.id and a.name='obsid' and a.value='oid080505';
which is significantly different than:
SELECT * FROM "tmp_table2" WHERE name='obsid' and value='oid080505';
The user had adapted that query for her needs, but it would have been
better to just use the query that you suggested (as the subselect in
the DELETE FROM...). Unfortunately, that only improves performance
slightly - it is still way too slow on deletes.
--
Steve Wampler -- [email protected]
The gods that smiled on your birth are now laughing out loud.
view thread (24+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Help speeding up delete
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox