From: John A Meinel <john@arbash-meinel.com>
To: Kevin <kev@drule.org>
Cc: arnaulist@andromeiberica.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Advise about how to delete entries
Date: Mon, 12 Sep 2005 01:06:41 -0400
Message-ID: <43250CE1.6090602@arbash-meinel.com> (raw)
In-Reply-To: <431D77F5.4070307@drule.org>
References: <43183AC9.1060704@andromeiberica.com>
<op.swhh87t5th1vuj@localhost>
<431C0F48.5050809@andromeiberica.com>
<431D77F5.4070307@drule.org>
Kevin wrote:
> Arnau wrote:
>
>> Hi all,
>>
>> >
>> > COPY FROM a file with all the ID's to delete, into a temporary
>> table, and do a joined delete to your main table (thus, only one query).
>>
>>
>> I already did this, but I don't have idea about how to do this join,
>> could you give me a hint ;-) ?
>>
>> Thank you very much
>
>
> maybe something like this:
>
> DELETE FROM statistics_sasme s
> LEFT JOIN temp_table t ON (s.statistic_id = t.statistic_id)
> WHERE t.statistic_id IS NOT NULL
>
Why can't you do:
DELETE FROM statistics_sasme s JOIN temp_table t ON (s.statistic_id =
t.statistic_id);
Or possibly:
DELETE FROM statistics_sasme s
WHERE s.id IN (SELECT t.statistic_id FROM temp_table t);
I'm not sure how delete exactly works with joins, but the IN form should
be approximately correct.
John
=:->
Attachments:
signature.asc (application/pgp-signature, 252B) download
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: pgsql-performance@postgresql.org
Cc: john@arbash-meinel.com, kev@drule.org, arnaulist@andromeiberica.com
Subject: Re: Advise about how to delete entries
In-Reply-To: <43250CE1.6090602@arbash-meinel.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox