> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW LOCALITY

The `SHOW LOCALITY` [statement](/docs/stable/sql-statements.md) returns the [locality](/docs/stable/cockroach-start.md#locality) of the current node.

If locality was not specified on node startup, the statement returns an empty row.

## Required privileges

No [privileges](/docs/stable/security-reference/authorization.md#managing-privileges) are required to list the locality of the current node.

## Synopsis

![show\_locality syntax diagram](https://mintcdn.com/cockroachlabs/UZNSFbmU2EwEm6G5/images/sql-diagrams/common/show_locality.svg?fit=max\&auto=format\&n=UZNSFbmU2EwEm6G5\&q=85\&s=930a066236ef2c164e24966497a0e20a)

## Example

### Setup

The following example uses MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see [MovR: A Global Vehicle-sharing App](/docs/stable/movr.md).

To follow along, run [`cockroach demo movr`](/docs/stable/cockroach-demo) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](/docs/stable/sql-name-resolution.md#current-database).

```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
$ cockroach demo movr --nodes=3 --demo-locality=region=us-east,az=a:region=us-central,az=b:region=us-west1,az=c
```

### Show locality

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW LOCALITY;
```

```
       locality
+---------------------+
  region=us-east,az=a
(1 row)
```

### Show locality with a built-in function

If you know the locality key, you can use the [`crdb_internal.locality_value`](/docs/stable/functions-and-operators#system-info-functions) built-in function to return the locality value for the current node:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SELECT * FROM crdb_internal.locality_value('region');
```

```
  crdb_internal.locality_value
+------------------------------+
  us-east
(1 row)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SELECT * FROM crdb_internal.locality_value('az');
```

```
  crdb_internal.locality_value
+------------------------------+
  a
(1 row)
```

For a more extensive example, see [Create a table with node locality information](/docs/stable/cockroach-start.md#create-a-table-with-node-locality-information).

## See also

* [Locality](/docs/stable/cockroach-start.md#locality)
* [Orchestrated Deployment](/docs/stable/kubernetes-overview.md)
* [Manual Deployment](/docs/stable/manual-deployment.md)
