"Delete after X months" option causing DB Deadlock
-
Hello,
I’ve been experiencing some issues with Statpress when attempting to clean up its log table. Turning the “automatically delete entries older than 6 months” option on caused my database to go into deadlock and run out of spare workers. Basically each page request caused an additional DELETE query to run. Each of these DELETE queries runs for around 60 seconds since the Statpress table still has over 2 million entries, and also each DELETE query was locking the Statpress table causing all the INSERTS (Statpress logging regular website activity) to wait. The result was about 100 queries waiting on a DELETE query to finish and preventing any other database connections (since there is a hard limit) which caused an outage. I’ve turned the option off and things are working again. Is it possible to run these DELETE queries on a periodic basis, like with WP’s cron?
- The topic ‘"Delete after X months" option causing DB Deadlock’ is closed to new replies.