cockroachdb / cockroachdb/cockroach

sql: GLOBAL IN SUPER REGION syntax to restrict global table replicas to a super region

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

Description

## Background

The original super regions design doc discussed `GLOBAL IN SUPER REGION` syntax to restrict global table replicas to a super region, but it was never implemented. Currently, global tables span all regions regardless of super regions.

See the proposal (from 2022) [here](https://docs.google.com/document/d/1gu5_ozPmyXrBKwVo_KikKkQxAYAe82IYOTJ9n5idn7M/edit?tab=t.0#heading=h.7quxegcm4ltd).

## Purpose

This issue tracks the potential future enhancement. No immediate work is needed unless customer demand arises.

## Potential Use Case

Data domiciling scenarios where even global reference data must stay within certain regions.

## Current Behavior

Global tables are not affected by super regions - their replicas are placed across all database regions for low-latency reads everywhere.

## Possible Syntax

```sql
ALTER TABLE promo_codes SET LOCALITY GLOBAL IN SUPER REGION Europe;
```

or

```sql
ALTER TABLE promo_codes SET LOCALITY REGIONAL BY SUPER REGION europe;
```

Jira issue: CRDB-59491

Epic CRDB-62586

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.