Re: [PERFORM] Deleting Records

2005-10-20 Thread Matteo Beccati
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.ite

Re: [PERFORM] Deleting Records

2005-10-20 Thread Christopher Kings-Lynne
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;

Re: [PERFORM] Deleting Records

2005-10-20 Thread Christopher Kings-Lynne
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; Item_qc_oder table contains 22,000 re

Re: [PERFORM] Deleting Records

2005-10-20 Thread Csaba Nagy
Christian, Do you have foreign keys pointing to your table with ON CASCADE... ? Cause in that case you're not only deleting your 22000 records, but the whole tree of cascades. And if you don't have an index on one of those foreign keys, then you might have a sequential scan of the child table on e

Re: [PERFORM] Deleting Records

2005-10-20 Thread Nörder-Tuitje , Marcus
what about firing a DELETE FROM qc_session S WHERE EXISTS (SELECT * FROM item_qc_doer i WHERE i.item_id = s.item_id); and DELETE FROM item_qc_doer S WHERE EXISTS (SELECT * FROM item_qc_doer i