SHOW REGIONS lists the for a multi-region cluster, or the for the databases in a multi-region cluster.
Synopsis
Required privileges
Only members of the can runSHOW REGIONS. By default, the root user belongs to the admin role.
Parameters
| Parameter | Description |
|---|---|
FROM CLUSTER | Show the for a cluster. Cluster regions are specified . |
FROM DATABASE | Show all for the current database. Database regions can be added , or . |
FROM DATABASE database_name | Show all database regions from the database named database_name. |
FROM ALL DATABASES | Show the database regions for all databases in the cluster. |
Response
SHOW REGIONS, SHOW REGIONS FROM CLUSTER, and SHOW REGIONS FROM DATABASE return the following fields for each region:
| Field | Description | SHOW REGIONS | SHOW REGIONS FROM CLUSTER | SHOW REGIONS FROM DATABASE |
|---|---|---|---|---|
region | The name of the region. | ✓ | ✓ | ✓ |
zones | The availability zones for the region. | ✓ | ✓ | ✓ |
database_names | A set of database names that use the region. | ✓ | ||
primary_region_of | A set of database names for which the region is the . | ✓ | ||
secondary_region_of | A set of database names for which the region is the . | ✓ | ||
database | The name of the database that uses the region. | ✓ | ||
primary | If true, indicates that the region is the primary region. | ✓ |
SHOW REGIONS FROM ALL DATABASES returns the following fields for each database:
| Field | Description |
|---|---|
database_name | The name of the database. |
regions | A set of region names in use by the database. |
primary_region | The primary region of the database. |
secondary_region | The of the database. |
Examples
Setup
The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see . To follow along, run with the and flags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with themovr database preloaded and set as the .
View the regions in a cluster
After cluster startup, you can view all of the cluster regions available in the cluster withSHOW REGIONS FROM CLUSTER:
View the regions in a single database
SHOW REGIONS FROM DATABASE returns the database regions for a specific database.
as the primary region for the movr database:
Only (i.e., regions that are defined at ) can be added to a multi-region database.
secondary column in each row says whether that region has been made a secondary region for failover purposes. For more information, see .
With movr set as the current database, the following statement returns the same results:
View the regions for all databases in a cluster
Create another database in the cluster with a primary region:SHOW REGIONS:
SHOW REGIONS FROM ALL DATABASES:

