Knowledgebase

Table Locking and Concurrency Print

  • databasesphpmyadmin, databases, plugins, woocommerce, performance, support, guide, howto
  • 0

Why writes sometimes wait.

WHAT LOCKING IS

While one operation writes, others may have to wait, to prevent conflicting changes.

THE DIFFERENCE BY ENGINE

MyISAM locks the whole table. One write blocks every read and write on that table.

InnoDB locks individual rows. Other operations on other rows continue.

This is the main practical reason InnoDB is preferable.

THE SYMPTOM

A site that becomes unresponsive during a specific operation: an import, a bulk update, or a plugin's scheduled task.

WHAT CAUSES CONTENTION

Long-running writes Large updates affecting many rows Schema changes, which lock the table while rewriting it Optimising a large table

WHAT TO DO

Run heavy operations at quiet times Batch large updates rather than doing them in one statement Convert MyISAM tables to InnoDB Keep transactions short

ON A BUSY SHOP

An import during trading hours can stall checkout. Schedule it overnight.

IF IT PERSISTS

Open a ticket with the times. We can see lock waits from the server side.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot