I have 45 queries each one of them update a value in the table odds this value is taken from an array $odds_results
for example $odds_results['1']
saved if the value of the column tahmin
equals to 1 and so on Like this:
$GLOBALS['db']->query("UPDATE odds_tahminler SET result = $odds_results[1], timestamp = timestamp where match_id= $match_id AND tahmin = 1");
$GLOBALS['db']->query("UPDATE odds_tahminler SET result = $odds_results[2], timestamp = timestamp where match_id= $match_id AND tahmin = 2");
$GLOBALS['db']->query("UPDATE odds_tahminler SET result = $odds_results[3], timestamp = timestamp where match_id= $match_id AND tahmin = 3");
$GLOBALS['db']->query("UPDATE odds_tahminler SET result = $odds_results[4], timestamp = timestamp where match_id= $match_id AND tahmin = 4");
$GLOBALS['db']->query("UPDATE odds_tahminler SET result = $odds_results[5], timestamp = timestamp where match_id= $match_id AND tahmin = 5");
I have 45 queries that execute in the same page in a cron job each 5 minutes that makes my CPU usage about 77% for this process . and that is killing my web server . Is there a way to solve this because I am not very familiar with MySQL queries ? Is there anyway to optimize this to reduce the CPU usage ?