Re: Deleting Records

Поиск
Список
Период
Сортировка
От Matteo Beccati
Тема Re: Deleting Records
Дата
Msg-id 43575ACD.8000206@beccati.com
обсуждение исходный текст
Ответ на Deleting Records  ("Christian Paul B. Cosinas" <cpc@cybees.com>)
Список pgsql-performance
Hi,

> What could possibly I do so that I can make this fast?
>
> Here is the code inside my function:
>
>     FOR temp_rec IN SELECT * FROM item_qc_doer LOOP
>         DELETE FROM qc_session WHERE item_id = temp_rec.item_id;
>         DELETE FROM item_qc_doer WHERE item_id = temp_rec.item_id;
>     END LOOP;

Qhat about just using:

DELETE FROM gc_session WHERE item_id IN
    (SELECT item_id FROM item_qc_doer)
DELETE FROM item_qc_doer;

It doesn't make sense to run 2 x 22.000 separate delete statements
instead that only two...

And... What about using a foreing key?


Best regards
--
Matteo Beccati
http://phpadsnew.com
http://phppgads.com

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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Deleting Records
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Deleting Records