开发者

multithreaded application & mysql

开发者 https://www.devze.com 2023-03-25 01:50 出处:网络
I\'m planning on a multithreaded application to get 1 row from MySQL, process data & save it. processing data takes about 10开发者_Go百科 seconds for each row & there are millions of rows and

I'm planning on a multithreaded application to get 1 row from MySQL, process data & save it. processing data takes about 10开发者_Go百科 seconds for each row & there are millions of rows and growing.

I want to select row & update status column to prevent other threads to access the row. But, in this short time that two queries are executing, other threads can access the row and using a multiquery or row locking cant prevent them.

How can i lock a row that other threads don't access to read that? Is it possible in MySQL? if not, which Database can I use instead?


MySQL Reference Manual :: SELECT .. FOR UPDATE and SELECT .. LOCK IN SHARE MODE Locking Reads

0

精彩评论

暂无评论...
验证码 换一张
取 消