SKIP LOCKED is a new feature in MySQL 8 that many will find
valuable. If allows you to not wait about for locked
records and work on what is available -- the unlocked
records.
How To Use SKIP LOCKED The MySQL world database has 274
records in the city table where the countryCode field equals
'USA' there are 274 records. From past interactions, we somehow
know there are some records with the ID field greater than
4000.
On MySQL shell number 1, start a transaction and lock some
records mysql>START TRANSACTION; mysql>SELECT *
FROM city WHERE ID > 4000 and countryCode = 'USA'; There
will be 66 records.
On MySQL shell number number 2, start a transaction and lets try
to lock the records starting at IS 3990 and up. mysql>START
TRANSACTION; mysql>SELECT FROM city WHERE id > 3990
and countryCode='USA'
FOR UPDATE SKIPPED LOCKED; There will be 10 records.
The records …
Showing entries 1 to 1
Nov
06
2017
Showing entries 1 to 1