I need to update an huge number of rows in Informix, but when a run the update statement, it locks everyone works with the table for the entire updates process.
The sql statement:
UPDATE informix.article SET article_qta_ord=NVL((select SUM(CASE WHEN(qta_ordered - NVL(qta_loaded, 0))>0 THEN (qta_ordered-NVL(qta_loaded, 0)) ELSE 0 END) from informix.order_table where order_article_code = article_code and whsId = '5'), 0)
Is It possible to use a stored procedure to an huge update with periodically commit or with select for update using rowid inside dbaccess in order to avoid to lock everyone for the entire updates process ?
using
SELECTFORUPDATEwithROWIDcan help in managing concurrency.This stored procedure uses a cursor with
SELECT FOR UPDATEto lock each row during processing. TheCOMMITstatement is used periodically to release locks and reduce contention. Adjust thecommit_intervalvariable to control how frequently commits occur.