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
- LockRowsrows 1 (estimated 1) cost 0.28..8.3 buffers: 7 hit
- Index Scan using artists_pkey on artistsrows 1 (estimated 1) cost 0.28..8.29 buffers: 6 hitindex condition
(id = 1)1 index searches
Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →