cockroachdb / cockroachdb/docs

improve SELECT FOR UPDATE

Open
#13,556 0 comments 0 reactions 1 assignee Assigned to @taroface View on GitHub
C-doc-improvement
Dominant language
HTML
Stars
212
Forks
476
Avg merge
40m
Merged PRs (30d)
3

Description

Tobias Grieger (tbg) commented:

Re: [SELECT FOR UPDATE](https://cockroachlabs.com/docs/v21.2/select-for-update.html)

## Issue Description

This page could be improved to better educate users on two salient points:

1. `ON UPDATE` locks are exclusive locks (see [here](https://github.com/cockroachlabs/support/issues/1527#issuecomment-1092938130)), so scanning rows `FOR UPDATE` also blocks reads to those rows that don't specify `FOR UPDATE`.
2. Predicates aren't always pushed down to the KV layer, so more locks may be taken out than expected. Ultimately, it matters which KV rows are scanned `FOR UPDATE`, not which ones are then matched by predicates in the SQL query.

Both are illustrated in [this comment](https://github.com/cockroachlabs/support/issues/1527#issuecomment-1092853810).

## Suggested Resolution

Docs update :-)

Jira Issue: DOC-3276

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.