This query is taking more than 90 seconds
UPDATE `tableA`
SET
`bill_no` = NULL
WHERE
`tableA`.`payment_no` = 'S00005303';
how to find the cause of slowness
I checked show processlist; and there are no other queries running at the same time.
2
Answers
The cause of slow performance you are experiencing could be caused by a number of things, which includes:
tableA
table is very large, and MySQL is scanning the entire table to find the one row with a payment number ofS00005303
If your application/use case would involve running this update often, you could try adding the following index:
This index, if used, would allow MySQL to rapidly find any records with a certain payment number, and make the update. To check if the index would be used, run:
What kind of database do you use? Is tableA indexed?