Dealing with the issue of optimization, due to the large number of database queries, the site often returns Error 500.
As a result, now most decided to get rid of requests through the cycles and try to collect all the data into an array, and generate 1 request.Was wondering
about multiple UPDATE in one request, but as I understand it is not possible.
Googled the Internet and came across:
LOCK TABLES `products` WRITE;
UPDATE `products` SET `description`='$text1' WHERE `name`='BMW';
UPDATE `products` SET `description`='$text2' WHERE `name`='ford';
UPDATE `products` SET `description`='$text3' WHERE `name`='lans';
Question 1: How do I UPDATE if need to update 100 records. Create 100 UPDATE queries?
Question 2: does it make sense to do a LOCK TABLES on the query execution time?
Question 3: How will the site, if for example I refresh the page, and she turns to the table that we blocked? The website will be loaded as long as the table is not rasplachivaetsya or until the timeout? or just return error?