1 year ago

Optimize MySQL to avoid locks

Posted 1 year ago by pilat


Regularly get errors like this:

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: delete from `custom_fields` where `subdomain` = subdomain_name and `deleted` = 1)

The query may really take quite a long time (too many records in this DB table), thus there are locks… Is there a way to make it in a lockless fashion? To split onto several smaller queries or something like that?

Please sign in or create an account to participate in this conversation.