Answer the question
In order to leave comments, you need to log in
PHP+SQL. How not to use database queries in a loop?
Good to everyone!
There is a constantly updated array with records. Data is added from this array to the database. It is necessary that each record in the array is checked for presence in the database. It turns out that when iterating over the array in each iteration, you need to make a request to the database? Is it possible in another way?
Answer the question
In order to leave comments, you need to log in
If you just need to add many records: Use INSERT IGNORE + bulk insert, like so:
well, do not forget about the indexes, and if the database is especially large, I recommend doing partitioning
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question