Update about 1 million rows in MySQL table every 1 hour |
By running calculation in SQL, I mean you need to skip your foreach completely and do all math in said SQL instead. Only passing in $currency_numbers_after_dot, $game_currency_percentage_max, $game_currency_speed_in_hour to the query and let it do everything for you.
Batch update are a third option, didn't think of that one. You can find an example on batch update in the user guide. It will be faster as you get 10 000 instead of 1 000 000 queries (per default). But not as fast as running it with one query. https://codeigniter.com/userguide3/datab...ating-data As you expect more than 1 000 000 users, you need to plan ahead. As it will just get slower every time. |
Messages In This Thread |
Update about 1 million rows in MySQL table every 1 hour - by olegrain - 07-21-2020, 01:20 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by jreklund - 07-21-2020, 06:59 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by olegrain - 07-21-2020, 07:27 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by ChicagoPhil - 07-22-2020, 01:01 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by jreklund - 07-21-2020, 08:35 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by php_rocs - 07-22-2020, 07:09 AM
RE: Update about 1 million rows in MySQL table every 1 hour - by John_Betong - 07-22-2020, 08:39 PM
|