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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to