Locking in CockroachDB, Part 1 - Locking Rows and Tables with SELECT FOR UPDATE

Locking rows in a database is a common way to prevent other transactions from modifying the data you are working on. But a transaction can hold onto rows for too long, or you can lock a whole table accidentally. These locks can be brief or indefinite if something has gone very wrong. I have written about locking and timeouts in CockroachDB in previous posts - CockroachDB and Postgres SELECT FOR…