Skip to main content
The SHOW SUPER REGIONS statement lists the super regions for a multi-region cluster.
This feature is in preview and subject to change. To share feedback and/or issues, contact Support.

Synopsis

show_regions syntax diagram

Required privileges

To view the super regions in a database, the user must have one of the following:

Parameters

Response

SHOW SUPER REGIONS FROM DATABASE returns the following fields for each super region:

Considerations

To use super regions, keep the following considerations in mind:

Examples

The examples in this section use the following setup.

Setup

Only a cluster region specified at node startup can be used as a database region. To follow along with the examples in this section, start a demo cluster with the --global flag to simulate a multi-region cluster:
To see the regions available to the databases in the cluster, use a SHOW REGIONS FROM CLUSTER statement:

Set up movr database regions

Execute the following statements. They will tell CockroachDB about the database’s regions. This information is necessary so that CockroachDB can later move data around to optimize access to particular data from particular regions. For more information about how this works at a high level, see Database Regions.

Set up movr global tables

Because the data in promo_codes is not updated frequently (a.k.a., “read-mostly”), and needs to be available from any region, the right table locality is GLOBAL.
Next, alter the user_promo_codes table to have a foreign key into the global promo_codes table. This will enable fast reads of the promo_codes.code column from any region in the cluster.

Set up movr regional tables

All of the tables except promo_codes contain rows which are partitioned by region, and updated very frequently. For these tables, the right table locality for optimizing access to their data is REGIONAL BY ROW. Apply this table locality to the remaining tables. These statements use a CASE statement to put data for a given city in the right region and can take around 1 minute to complete for each table.
  • rides
  • user_promo_codes
  • users
  • vehicle_location_histories
  • vehicles

Enable super regions

To enable super regions, set the enable_super_regions session setting to 'on':
You can also set the sql.defaults.super_regions.enabled cluster setting to true:

View the super regions from a database

SHOW SUPER REGIONS FROM DATABASE returns the super regions for the specified database.
The preceding example shows the super region that was added in ADD SUPER REGION.

See also