I have a database project in php and mysql. For, hopefully redundant, data security I added a LIMIT 1 to the delete($uniqueID) php function we use.

Nobody cared because records really aren't supposed to be deleted often from this database. However we recently got a massive jump in the response time for this server. By massive I mean approximately four times worse than our previous worst heavy load performance.

The culprit seems to be a series of 100 individual DELETE statements from a small table, about 7 columns and 150 records. This doesn't seem right. Is it possible that this newly added LIMIT 1 is obliterating performance?

I don't think so, but the data logging I have suggest that it is.

1 Answer 1


No, at least not in this case.

The evidence pointing towards a DELETE ... LIMIT 1 was real, but not entirely accurate. The real issue here was a PHP script that called hundreds of unnecessary queries in order to execute the suspected DELETE ... LIMIT 1 query.

Using MySQL's log all queried on a test environment lead to the solution to this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.