'How to sequenced a query conditionally to avoid any timeout?

So basically, I have this current query :

UPDATE act AS a
INNER JOIN blob AS b
ON b.fav_pat = a.pat_id
SET a.blob_id = b.id

This request take far too long in the current aspect, is there a way to apply partially this request (by iterating through differents values of a column) like :

for each id :
UPDATE act AS a
INNER JOIN blob AS b
ON b.fav_pat = a.pat_id
SET a.blob_id = b.id WHERE port.id = id

Is there a way to do it in MYSQL and if so, what is the optimal way of doing it ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source