I am using mysql + php for my web application and I am using sql locks to make sure that multiple instances of my php script select different rows from a mysql table.
What I need to ask is, if I am locking few rows of a table using FOR UPDATE clause, and the other instance use the same query, which is a simple select statement with ORDER BY and LIMIT clause, will the second instance select the next rows skipping the locked rows or will it wait for the first instance transaction to be completed?
I want that it should just skip the rows which are locked and retrieve next set of rows from the table. For example, I have a sql table with users and a column user_LastUpdated with timestamp
My query would be something like
SELECT * FROM users ORDER BY user_LastUpdated LIMIT 5 FOR UPDATE
If the users table have huge amount of rows, can two instances running the above query return simultaneous results?