Investigation of locks on MySQL tables

Lately we experienced huge lags on one of our replica. Therefore I had to check queries and locks on tables. Sources: Show all current locks from get_lock Activate performance_schema.metadata_locks: activate without restart: UPDATE performance_schema.setup_instruments...

Locking strategies

Different storage engines implement their own locking policies and granularities but some commands overcome storage engines. For example “Alter table” locks whole table regardless of engine. Basically there are two levels of locks – table lock and...