cockroachdb / cockroachdb/cockroach

sql: support region-local ON DELETE SET NULL for foreign keys on REGIONAL BY ROW tables

Open
#172,642 2 comments 0 reactions 0 assignees View on GitHub
A-multiregion C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem?

For `REGIONAL BY ROW` tables, a foreign key with `ON DELETE SET NULL` can require cross-region reads/writes when the referencing rows live in a different region than the deleted row. This adds cross-region latency to cascading deletes/updates.

### Describe the solution you'd like

Provide a region-local form of `ON DELETE SET NULL` for foreign key constraints on `REGIONAL BY ROW` tables, so the cascade action can be resolved within the local region (analogous to other region-local optimizations for RBR tables), avoiding cross-region hops.

### Additional context

Relevant to multi-region foreign-key performance for `REGIONAL BY ROW` tables. Tracking this for 26.4 planning.

Jira issue: CRDB-65897

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is identified in the issue. Begin by locating the existing region-local optimizations for REGIONAL BY ROW foreign keys and the ON DELETE SET NULL implementation; done means an agreed design with coverage for local cascade behavior and cross-region cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases, distributed-systems, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.