Professional Data Engineer free question 4 / 10 · Domain 2: Ingesting and processing the data
For BigQuery federated queries, which statement about the combination of the dataset location and the external database location matches the "Introduction to federated queries" page?
- A single-region BigQuery dataset can also query an external database such as Cloud SQL in a different region within the same larger geography
- Spanner can be queried only if the instance has a regional configuration and is in the same region as the dataset
- When you query an external database from a multi-region dataset, the query processing location is the US or EU multi-region
- Cloud SQL instances can also be placed in a multi-region location, so you can set up queries between multi-regions
Show the answer and explanation
Answer: C
Why this is correct
The "Supported regions" section for AlloyDB and Cloud SQL says that a query run in the BigQuery US multi-region can query any single region in the US geography (such as us-central1, us-east4, or us-west2), and a query run in the EU multi-region can query any single region in an EU member state. It then says the query processing location is the US or EU multi-region. The processing location is that of the multi-region the query runs in, not the region of the external database.
Why the other options are wrong
"A single-region BigQuery dataset can also query an external database such as Cloud SQL in a different region within the same larger geography" … The "Supported regions" section says a single BigQuery region can query only resources in the same region. For a dataset in us-east4, you can query only Cloud SQL or AlloyDB instances in us-east4.
"Cloud SQL instances can also be placed in a multi-region location, so you can set up queries between multi-regions" … The section says Cloud SQL instances cannot use multi-region locations; multi-region is used only for backups.
"Spanner can be queried only if the instance has a regional configuration and is in the same region as the dataset" … The Spanner section says it supports both regional and multi-region configurations, and that from a single region or a multi-region in BigQuery you can query a Spanner instance in any supported region.
Key point
The location where the query runs must be the same as the location of the connection resource, so a query run from the US multi-region uses a connection in the US multi-region. A query that starts from a multi-region can no longer refer to a single-region connection, so recreate such connections in the same multi-region as the query. Performance depends on how close the dataset and the external data source are: between the US multi-region and Cloud SQL in us-central1 it is fast, but with Cloud SQL in us-east4 it can be slower.