Welcome Guest, Not a member yet? Register   Sign In
Update about 1 million rows in MySQL table every 1 hour

(07-21-2020, 07:27 AM)olegrain Wrote:
(07-21-2020, 06:59 AM)jreklund Wrote: By the looks of things you are executing (at least want to) one million + 1 query every hour. That's a lot. Depending on what you wan't to do with your data you need to rethink your structure.

1. Fetching/calculating only when needed
2. Run all calculations in SQL

Thank's for answer. If I run all calculations in SQL for example:

PHP Code:
$this->db->set("game_available_balance""game_available_balance + " $game_balance_in_hour_amountFALSE

is this SQL query will be faster than if I make calculations in php?

And another question: if will use batch update, is it more faster than foreach? If yes, can you write an example of batch update for my case?

I’m not actually going to answer your question about the framework but just wanted to mention that for each loops captures all the data into memory. That would be a very bad thing with large data. I believe a while loop would save you on memory issues. While loop should go line by line resulting in lower memory usage.

Messages In This Thread
RE: Update about 1 million rows in MySQL table every 1 hour - by ChicagoPhil - 07-22-2020, 01:01 AM

Theme © iAndrew 2016 - Forum software by © MyBB