Reputation: 1350
For example:
SELECT * FROM table1 ORDER BY id DESC FOR UPDATE
will this lock all the rows?
Upvotes: 0
Views: 29
Reputation: 781761
Yes, it locks all the rows. From the documentation:
A SELECT ... FOR UPDATE reads the latest available data, setting exclusive locks on each row it reads. Thus, it sets the same locks a searched SQL UPDATE would set on the rows.
Upvotes: 2