Re: Delete performance

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Delete performance
Date: 2009-06-14 17:21:36
Message-ID: 4A3531A0.5060102@sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Frank Bax wrote:
> Jana wrote:
>>
>> Hello,
>> i have a table with about 250m records from which i want to delete
>> thoose not contained in other table. I used this SQL query:
>> DELETE FROM data_structures_items WHERE id_data_structure NOT IN (
>> SELECT id_structure FROM data_structures);
>
>
> DELETE FROM data_structures_items, data_structures WHERE
> data_structures_items.id_data_structure =
> data_structures.id_data_structure AND
> data_structures_items.id_data_structure IS NULL;
>

Sorry; that should probably be:

DELETE FROM data_structures_items, data_structures WHERE
data_structures_items.id_data_structure =
data_structures.id_data_structure AND
data_structures.id_data_structure IS NULL;

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jana 2009-06-15 13:33:45 Re: Delete performance
Previous Message Frank Bax 2009-06-14 16:12:50 Re: Delete performance