Skip to main content
← Back to Patterns

BigQuery global queries or a local serving copy?

By Ivan Richter LinkedIn

Last updated:

6 min read

In brief

A global BigQuery query can suit occasional selective reads. An approved local copy can save transfers when reports repeatedly read the same remote data.

  • Compare daily query traffic with refresh traffic at the required frequency.
  • Serve the last validated copy only while it meets the freshness limit.
On this page

A report joins transaction history in europe-west1 to reference data in us-central1. The team can write a global BigQuery query that crosses that boundary. Before putting it behind a frequently opened report, we’d compare what moves on every query with what a small, maintained serving copy would move on each refresh.

For repeated reads of broadly the same remote data, we’d prefer an approved projection in the report’s execution region, provided its refresh path meets the required freshness. A few selective queries can make global execution the simpler and cheaper choice. Base the decision on the data the workload transfers.

Both choices move data. If the selected fields aren’t allowed in the report’s execution region, neither temporary query copies nor a permanent serving table solves that restriction. Resolve the allowed destination and projection first.

Choose where the report executes

Keep the large transaction history in europe-west1, evaluate moving the reference projection there, and record the exact location IDs. A nearby region isn’t interchangeable with the one that holds the dataset: location determines where a job runs and which regional reservation it uses.

Specify the execution location in the job configuration, or with SET @@location where the client supports it. For a global SELECT without a destination table or a specified location, BigQuery can choose among the referenced locations. That choice decides which side moves. Statements with a target or destination follow different location rules.

Write down which reference columns, rows, and historical versions the join requires. If a report uses product category at the time of sale, copying only today’s category produces a different answer.

The source owner should approve the projection’s meaning and data exposure before anyone measures its size. Both options then answer the same question.

Global execution still has a transfer step

Global queries are currently in Preview. BigQuery runs remote subqueries, copies their results to the primary location, and finishes the query there. The bill can include remote and primary compute, transfer, and temporary storage. Repeated queries transfer the data again: no cache eliminates the cross-region step.

The executing project needs global execution enabled for its region, and the source project needs data access enabled for the remote region. These are separate configuration settings, both disabled by default. Review their scope alongside the identities and tables involved, and decide which data may leave before enabling either setting.

The operator also needs bigquery.jobs.createGlobalQuery. A custom role can grant it without the broad BigQuery Admin role.

Once ordinary job and data permissions are in place, test with the report’s own identity. The connector’s identity and execution mode can differ from a developer’s console session.

Current limitations require Data Studio global queries to use a view and Viewer’s Credentials. Referencing STRUCT columns disables remote pushdowns. A source-side view exposing the required scalar fields can change the transfer work enough to change the decision.

Test the generated query shape with representative filters. A console query that returns few rows can still transfer a lot.

Compare transfer volume at the required freshness

Consider a made-up projection that transfers 10 GiB when moved in full. If a representative global query also transfers 10 GiB and the report generates 100 such queries per day, that’s 1,000 GiB of daily transfer. A local copy that refreshes the complete projection 24 times per day would transfer 240 GiB.

The figures assume the same data, count every successful full transfer, and exclude retries. The local design also pays to prepare and store its copy. Both designs still pay for query execution under their own pricing models.

Convert the comparison into money only with your regional rates and billing units.

Now change the workload. At two full remote reads per day, global queries transfer 20 GiB against the copy’s 240 GiB. Or keep 100 reads but make each transfer only 0.1 GiB after effective filtering: global queries transfer 10 GiB. A frequently used report can still favor global execution when its requests are selective enough.

For a first estimate, multiply observed transfer per representative read by reads per day, then compare it with observed transfer per refresh multiplied by refreshes per day. Group different query shapes separately: a customer lookup and an unrestricted quarterly export shouldn’t share one average if their frequency is likely to change.

Add the time needed to run and maintain the refresh.

A saving that requires a new publishing service, custom retries, and regular investigation may not be worth it for a small report. But an existing reliable publication path can make a narrow serving copy cheap to operate. Record that difference, or the comparison prices engineering work at zero.

Pick a refresh mechanism that can do the job

Dataset copying is in Beta and has a minimum interval of 12 hours. An hourly freshness requirement rules it out before price comes into it.

It doesn’t copy views, routines, or external tables. A changed source table is copied by replacing the destination’s contents, not by appending only the new rows.

An individual cross-region table copy is another option, currently in Preview.

Check source eligibility, encryption, size limits, and copy quotas before choosing it. If the documented restriction on source policy tags blocks the copy, review the data design. Leave the tags on. A separately approved, limited projection may be suitable where the full source table isn’t.

For a continuously maintained dataset, cross-region replication offers a read-only secondary. Set the query location to the secondary region. Check its synchronization state. Replication is asynchronous, with additional caveats for streamed data.

Its transfer can include whole modified storage files, so changed business-row bytes don’t directly predict replication bytes. Price that path from its observed transfer and secondary storage.

Replicating a narrow publication dataset may be easier to justify than replicating the entire warehouse for one report. Keep the projection close to its source. Let its owner change it through the same review process as the report contract. That way, a new sensitive column gets reviewed before replication carries it to another region.

If no managed path meets your release-stage, object, or freshness requirements, assess the documented export, transfer, and load route. It adds its own storage and job management. Reuse an existing path if you have one.

We wouldn’t build that machinery to avoid a few acceptable global reads.

Inspect the whole job and the stale-copy behavior

Collect evidence from the report itself: returned values, elapsed time, transferred bytes, remote compute, query location, and identity. Keep one normal filtered read and one intentionally broad read the report allows. Include the expected refresh traffic in the same observation window, because a comparison that leaves out refresh work flatters the copy.

The Job API records remote regions on the parent job in globalQueryRemoteRegions. Remote child jobs identify their parent through parentGlobalQueryJob, including project, job ID, and location. Use that relationship to collect the remote work. The primary execution graph doesn’t report all remote transfer evidence. Inspect the corresponding copy jobs as well.

A failed global query can still incur charges for completed replication, so a retry can cost more even when the user never saw a result. Count failed attempts alongside successful reads when you estimate the workload. Multiplying one successful demonstration by the expected page views misses them.

For a maintained copy, define what readers see when refresh fails.

We’d publish a candidate only after checking its source cutoff, expected keys, and schema. Until a new candidate passes, we’d keep serving the last accepted version while it stays within the agreed age limit. Beyond that limit, the report should show that it has no acceptable current result. The publication mechanism belongs in the pipeline design, but settle its freshness consequence before choosing the copy.

Record the source location, allowed projection, execution location, chosen movement mechanism, and acceptable age with the report. Note the read and refresh volumes the comparison assumed too, because broader reads, more frequent refreshes, or a resized remote projection can each reverse it.

More in this domain: Data

Browse all

Related patterns