Re: Bulk processing & deletion

From: pasman pasmański <pasman(dot)p(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Bulk processing & deletion
Date: 2011-10-14 06:06:32
Message-ID: CAOWY8=Y=j9Zypq=GHaUjZBXknVY+yc9kBEH2swb8ZHMr9wcBHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Unlogged tables can't be temporary.

2011/10/13, Ivan Voras <ivoras(at)freebsd(dot)org>:
> On 13/10/2011 14:34, Alban Hertroys wrote:
>
>>> Any other ideas?
>>
>> CREATE TABLE to_delete (
>> job_created timestamp NOT NULL DEFAULT now(),
>> fk_id int NOT NULL
>> );
>>
>> -- Mark for deletion
>> INSERT INTO to_delete (fk_id) SELECT id FROM table WHERE condition = true;
>>
>> -- Process in app
>> SELECT table.* FROM table INNER JOIN to_delete ON (table.id =
>> to_delete.fk_id);
>>
>> -- Delete them
>> DELETE FROM table WHERE id IN (SELECT fk_id FROM to_delete);
>
> Good point. I can even use a temp table for this and make use of
> UNLOGGED temp tables when we upgrade to 9.1!
>
>
>

--
------------
pasman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2011-10-14 08:25:01 Re: function "XXX" already exists with same argument types
Previous Message Scott Marlowe 2011-10-14 04:33:23 Re: Tablespace files deleted during continuous run