Re: Bulk processing & deletion

Поиск
Список
Период
Сортировка
От Ivan Voras
Тема Re: Bulk processing & deletion
Дата
Msg-id j76m54$l39$1@dough.gmane.org
обсуждение исходный текст
Ответ на Re: Bulk processing & deletion  (Alban Hertroys <haramrae@gmail.com>)
Ответы Re: Bulk processing & deletion  (pasman pasmański <pasman.p@gmail.com>)
Список pgsql-general
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!



Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Gregg Jaskiewicz
Дата:
Сообщение: Re: Bulk processing & deletion
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: pg 8.3 replication causing corruption