Dataset locations

This page explains the concept of data location and the different
locations where you can create datasets. To learn how to set the location for
your dataset, see Creating datasets.

For information on regional pricing for BigQuery, see the
Pricing page.

Key concepts

You specify a location for storing your BigQuery data when you
create a dataset. After you create the dataset, the location cannot be changed,
but you can copy the dataset to a different region.

There are two types of locations:

A regional location is a specific geographic place, such as Tokyo.
For more information, see Regional resources
on the Geography and Regions page.

A multi-regional location is a large geographic area, such as the
United States, that contains at least two geographic places. For more
information, see Multi-regional resources
on the Geography and Regions page.

Multi-regional locations

1 Data located in the EU multi-region is not
stored in the europe-west2 (London) or the europe-west6 (Zürich) data
centers.

Note: If you choose EU for the dataset location, your Core
BigQuery Customer Data resides in the EU. Core
BigQuery Customer Data is defined in the
Service Specific Terms.

Specifying your location

When loading data, querying data, or exporting data, BigQuery
determines the location to run the job based on the datasets referenced in
the request. For example, if a query references a table in a dataset stored
in the asia-northeast1 region, the query job will run in that region. If a
query does not reference any tables or other resources contained within
datasets, and no destination table is provided, the query job will run in the
location of the project's flat-rate reservation.
If the project does not have a flat-rate reservation, the job runs in the US
region. If more than one flat-rate reservation is associated with the project,
the location of the reservation with the largest number of slots is where the
job runs.

To specify the location to run a job explicitly:

When you query data using the GCP Console, click
More > Query settings, and for Processing Location, click
Auto-select and choose your data's location.

When you query data using the classic BigQuery web UI, click Show Options, and
for Processing Location, click Unspecified and choose your data's
location.

When you use the command-line tool, supply the --locationglobal flag
and set the value to your location.

When you use the API, specify your region in the location
property in the jobReference section of the job resource.

BigQuery returns an error if the specified location does not match
the location of the datasets in the request.

Location considerations

When you choose a location for your data, consider the following:

Colocate your BigQuery dataset and your external data source.

When you query data in an external data source
such as Cloud Storage, the data you're querying must be in the same location as your
BigQuery dataset. For example, if your BigQuery dataset is in the
EU multi-regional location, the Cloud Storage bucket containing the data you're querying
must be in a multi-regional bucket in the EU. If your dataset is in the US multi-regional
location, your Cloud Storage bucket must be in a multi-regional bucket in the US.

If your dataset is in a regional location, the Cloud Storage bucket containing the data
you're querying must be in a regional bucket in the same location. For example, if your
dataset is in the Tokyo region, your Cloud Storage bucket must be a regional bucket in
Tokyo.

If your external dataset is in Cloud Bigtable, your dataset must be in the US or the EU
multi-regional location. Your Cloud Bigtable data must be in one of the
supported Cloud Bigtable locations.

If your BigQuery dataset is in a multi-regional location, the Cloud Storage
bucket containing the data you're loading must be in a regional or multi-regional bucket in
the same location. For example, if your BigQuery dataset is in the EU, the
Cloud Storage bucket must be in a regional or multi-regional bucket in the EU.

If your dataset is in a regional location, your Cloud Storage bucket must be a regional
bucket in the same location. For example, if your dataset is in the Tokyo region, your
Cloud Storage bucket must be a regional bucket in Tokyo.

Exception: If your dataset is in the US multi-regional location,
you can load data from a Cloud Storage bucket in any regional or multi-regional location.

Colocate your Cloud Storage buckets for exporting data.

When you export data, the regional or multi-regional Cloud Storage bucket must be in the
same location as the BigQuery dataset. For example, if your
BigQuery dataset is in the EU multi-regional location, the Cloud Storage
bucket containing the data you're exporting must be in a regional or multi-regional location
in the EU.

If your dataset is in a regional location, your Cloud Storage bucket must be a regional
bucket in the same location. For example, if your dataset is in the Tokyo region, your
Cloud Storage bucket must be a regional bucket in Tokyo.

Exception: If your dataset is in the US multi-regional location,
you can export data into a Cloud Storage bucket in any regional or multi-regional location.

Copying datasets

Moving a dataset

To manually move a dataset from one location to another, follow this process:

Export the data from your BigQuery
tables to a regional or multi-region Cloud Storage bucket in the same location as your
dataset. For example, if your dataset is in the EU multi-region location, export your data
into a regional or multi-region bucket in the EU.

There are no charges for exporting data from BigQuery, but you do incur charges
for storing the exported data in
Cloud Storage. BigQuery exports are subject to the limits on
export jobs.

Copy or move the data from your Cloud Storage bucket to a regional or multi-region bucket
in the new location. For example, if you are moving your data from the US multi-region
location to the Tokyo regional location, you would transfer the data to a regional bucket in
Tokyo. For information on transferring Cloud Storage objects, see
Renaming, copying, and moving objects
in the Cloud Storage documentation.

After you transfer the data to a Cloud Storage bucket in the new location, create a new
BigQuery dataset (in the new location). Then, load your data from the
Cloud Storage bucket into BigQuery.

You are not charged for loading the data into BigQuery, but you will incur
charges for storing the data in Cloud Storage until you delete the data or the bucket. You
are also charged for storing the data in BigQuery after it is loaded. Loading
data into BigQuery is subject to the limits on
load jobs.