Home / Companies / Cockroach Labs / Blog / Post Details
Content Deep Dive

When and Why to Use SELECT FOR UPDATE in CockroachDB

Blog post from Cockroach Labs

Post Details
Company
Date Published
Author
John Kendall
Word Count
1,077
Language
English
Hacker News Points
-
Summary

CockroachDB has introduced SELECT FOR UPDATE to simplify handling of client-side transaction retry errors and improve performance. This feature allows applications to take explicit control of row-level locking on a per-statement basis, reducing the need for developers to implement retry-loops for contended transactions. Benchmarking with YCSB (Yahoo! Cloud Serving Benchmark) showed that enabling SELECT FOR UPDATE in CockroachDB 20.1 improved throughput, tail latency, and reduced the number of transaction retry errors compared to v19.2.