How to solve the problem that php sql update updates a large amount of data and fails to respond when it times out?
UPDATE `addon` SET `productsimages`= concat(productsimages,"-sharp-sharp","BD-PT4878-1.jpg"),`jieshao`=concat(jieshao,"-sharp-sharp","Immunohistochemical analysis of paraffin-embedded human-stomach-cancer tissue. 1,VIM PolBD-PClonal Antibody was diluted at 1:200(4,overnight). 2, Sodium citrate pH 6.0 was used for antigen retrieval(>98C,20min). 3,Secondary antibody was diluted at 1:200room temperature, 30min) Negtive control was used by secondary antibody only.)") WHERE typeid="190" AND catalogno="BD-PT4878";
catalogno is not an index
executes more than 1W statements as above, and there is no response.
is divided into two times, and 5000 are still unresponsive at a time.
tried to combine the array, and then foreach executed it, and there was no response.
what to do--
whether a large number of update business operations occur sporadically or frequently under certain circumstances
if it is occasional, it is recommended to stop business operations
if it is a frequent operation, consider whether the business can do timely processing or distribute messages asynchronously
there is no time limit for the direct operation above. You can start a process and process a certain number of updates at regular intervals, for example, 100 updates per minute, and then sleep (10) iterative processing.
pseudo code
$limit = 0;
$offset = 100;
while(true) {
$data = getLists($limit);
// operate
doit($data);
sleep(10);
// log
$limit += $offset;
}
if you can, write a script, then update N items each time, and then add a contab scheduled task to cycle through your script until all update is finished.
this is easy to solve, or the problem of index efficiency.
UPDATE `addon` SET `productsimages`= concat(productsimages,'-sharp-sharp','BD-PT4878-1.jpg'),`jieshao`=concat(jieshao,'-sharp-sharp','Immunohistochemical analysis of paraffin-embedded human-stomach-cancer tissue. 1,VIM PolBD-PClonal Antibody was diluted at 1:200(4,overnight). 2, Sodium citrate pH 6.0 was used for antigen retrieval(>98C,20min). 3,Secondary antibody was diluted at 1:200room temperature, 30min) Negtive control was used by secondary antibody only.)') WHERE id in (select id from addon where typeid='190' AND catalogno='BD-PT4878');
This function set_time_limit (0) is called in the
program; after
, there is still no response after the timeout, but this is the timeout processing of nginx. In fact, your php program is still running, and your data should still be update,. You just don't know when to finish it
.