I have an app that needs to update a large amount of data over a large number of entries. Basically it does some 7,000 inserts and/or updates but it takes a looooong time (l
If you're not already, use prepared statements (via either mysqli
, PDO
, or some other DB library that supports them). Reusing the same prepared statement and simply changing the parameter values will help speed things up, since the MySQL server only has to parse the query once.
INSERT
s can be batched by providing multiple sets of VALUES
- a single query that inserts many rows is much faster than an equivalent number of individual queries each inserting one row.