Example data: 1,000,000 rows
Structure: id (int), randomText(char 10), flag(boolean)
index creates for id, randomText and flag
This is mysql command:
update table_NAME set flag =
( select flag from
( select @randomText:=randomText as 'randomText', '1' as flag
from table_NAME where flag=0 limit 1
) as tmp
) where randomText=@randomText;
Typically this took less than one second, but when I try to query it 1000 threads, it becomes almost 2 minutes, I tried InnoDB, MyISAM and MEMORY but no help.
I just want to get the randomText 500 at once (no dupplicate) and keep it loops.
What do you suggest?