M
M
Mark Dio2016-10-25 13:06:35
MySQL
Mark Dio, 2016-10-25 13:06:35

How to properly update records in a MySQL table based on data from an array?

Hello friends.
There is a question about the optimal algorithm for updating data in an existing MySQL table of goods from an array. The array is taken from a third-party resource in which both the cost, quantity, and other characteristics of an existing product change, as well as new products can be added. The number of records so far is about 1000 pieces. - a little, but maybe a lot more over time.
How to optimally solve this problem with the prospect of increasing the number of records in the table?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-10-25
@Touranchoks

Loop through the array and update. There is an updateAll method, sometimes justified. Everything depends on the situation. It's not entirely clear what the problem is? You don't know how? Or don't know which option to choose? If the latter, please provide alternatives.

R
romy4, 2016-10-25
@romy4

if you are not updating 1 million items, then solve it somehow. you will be doing premature optimization longer. there will be a solution, you will see the speed, then you will already understand what to optimize.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question