Push the records to be updated in batches into the queue, and then consume the queue. Remember to log. We make queues to execute tasks in an orderly manner and ensure that each update is completed.
1. If it is the same table and has certain same characteristics, some data can be updated in batches using where conditions
update table set count=count+1 where id > 1 and id < 501
2. If the tables are different and the logic is different, then you need to consider whether it will time out. If the request does not require user payment, you can use fastcgi_finish_request to interrupt the user request and continue to execute the code, or take the form of a scheduled task
Push the records to be updated in batches into the queue, and then consume the queue. Remember to log. We make queues to execute tasks in an orderly manner and ensure that each update is completed.
I don’t know the specific usage scenario, so I don’t dare to fool around with it
Baby
After taking out a large array
1. If it is the same table and has certain same characteristics, some data can be updated in batches using where conditions
2. If the tables are different and the logic is different, then you need to consider whether it will time out. If the request does not require user payment, you can use
fastcgi_finish_request
to interrupt the user request and continue to execute the code, or take the form of a scheduled taskFirst determine the total number of times, and then use the for loop to get 500 updates each time