Plan nodes · Modifying data

LockRows

Locks the rows it returns (SELECT … FOR UPDATE / FOR SHARE).

Locks each row before returning it, waiting for other transactions that hold a conflicting lock, and re-checks the row if it changed meanwhile.

Example

SELECT * FROM artists WHERE id = 1 FOR UPDATE

2 nodes

Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →

Related

ModifyTable