Row locking
# FOR UPDATE
This clause is used as part of a select query and can define:
- The lock strength. See also https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-ROWS
- Name the specific tables in the query whose rows should be locked. If no table is specified, all tables used in the query are locked.
- What action to take if encountering lock contention
See also https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE
# Advisory Locks
These aren’t row locks, but worth mentioning. You can use these to control concurrency in general, even things not explicitly tied to data in the database. See also: