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
Post a Comment