Querying in Specific Spanner Region

In a multi region spanner database, is it possible to mention the specific region where the query should be executed?

Use case is, we want to restrict the read only users from submitting adhoc queries in the default leader region. Data consistency or latency is not an issue for these low priority queries. Users typically use cloud console or DBeaver to run such queries.

0 1 270
1 REPLY 1

Yes, in Google Cloud's Spanner database, you can specify the region where a query should be executed. This is achieved through the use of configurable read-only replicas. You can add these replicas to any regional or multi-regional Spanner instance, which then allows you to deliver low-latency stale reads to clients in any geography.

To specify the region where a query should be executed, you can add read-only replicas to a configuration from the Create Instance page in the Google Cloud console. In the "Configure read-only replicas" section, you can select the region for the read-only replica and also specify the number of replicas you want per node. Then, create the instance.

With this setup, you can redirect low priority, read-only traffic from users to these read-only replicas in the regions you have specified, thereby avoiding the submission of ad-hoc queries in the default leader region​

For more details please refer to the following blog post: https://cloud.google.com/blog/products/databases/introducing-spanner-configurable-read-only-replicas