Is there a way to slowdown mysql query for lower cpu usage? -


i ordering int rows desc on table 300k rows , selecting @rownum:=@rownum+1 update same row's rank field.

it works takes long time. can accept longer time, can let sleep give free space cpu make other jobs?

like putting sleep(0.25 sec) in while(1>0) loop...

update: set @rownum=0; update user u, (select @rownum:=@rownum+1 rank, id user u order score desc) bb set u.rank=bb.rank u.id=bb.id

no. can have minor influence on priority insert delayed statement, adding low_priority update, or adding high_priority select. affects queueing table locks in storage engines using them. cannot have more granular control that. shouldn't way either, since dbms balance internally, , 1 slow query should never make query much slower. if 'other jobs' mean other tasks on same server, ionice or nice entire mysqld process.

having answered actual question, query slow because misses index on field you're sorting by, such triggering filesort , temporary flags on execution plan. fixing might make whole point moot.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -