Introduction to saved queries
This document provides an introduction to saved queries and classic saved queries in BigQuery.
Saved queries
This document provides an introduction to saved queries in BigQuery. You can use saved queries to create and manage SQL scripts. Saved queries improve collaboration and query management with the following options:
- Share queries with specific users and groups by using Identity and Access Management (IAM).
- Review the query version history.
- Revert to or branch from previous versions of the query.
Saved queries save both the query text and the query settings.
Saved queries are BigQuery Studio code assets powered by Dataform. Notebooks are also code assets. All code assets are stored in a default region. Updating the default region changes the region for all code assets created after that point.
Saved query capabilities are available only in the Google Cloud console.
Saved query security
You control access to saved queries by using Identity and Access Management (IAM) roles. For more information, see Grant access to saved queries.
Supported regions
BigQuery Studio lets you save, share, and manage saved queries. The following table lists the regions where BigQuery Studio is available:
Region description | Region name | Details | |
---|---|---|---|
Africa | |||
Johannesburg | africa-south1 |
||
Americas | |||
Columbus | us-east5 |
||
Dallas | us-south1 |
Low CO2 | |
Iowa | us-central1 |
Low CO2 | |
Los Angeles | us-west2 |
||
Las Vegas | us-west4 |
||
Montréal | northamerica-northeast1 |
Low CO2 | |
N. Virginia | us-east4 |
||
Oregon | us-west1 |
Low CO2 | |
São Paulo | southamerica-east1 |
Low CO2 | |
South Carolina | us-east1 |
||
Asia Pacific | |||
Hong Kong | asia-east2 |
||
Jakarta | asia-southeast2 |
||
Mumbai | asia-south1 |
||
Seoul | asia-northeast3 |
||
Singapore | asia-southeast1 |
||
Sydney | australia-southeast1 |
||
Taiwan | asia-east1 |
||
Tokyo | asia-northeast1 |
||
Europe | |||
Belgium | europe-west1 |
Low CO2 | |
Frankfurt | europe-west3 |
Low CO2 | |
London | europe-west2 |
Low CO2 | |
Madrid | europe-southwest1 |
Low CO2 | |
Netherlands | europe-west4 |
Low CO2 | |
Turin | europe-west12 |
||
Zürich | europe-west6 |
Low CO2 | |
Middle East | |||
Doha | me-central1 |
||
Dammam | me-central2 |
Quotas and limits
For more information, see Saved query quotas and limits.
Limitations
Saved queries have the following limitations:
- You can
grant public access to saved queries
only to the
allAuthenticatedUsers
principal. You can't grant access to saved queries to theallUsers
principal. - If your Google Cloud project contains more than 2500 classic saved queries, you can't use batch migration (Preview) to migrate classic saved queries to saved queries.
Classic saved queries
Classic saved queries are an earlier way of saving and sharing SQL queries. Classic saved queries provide the query text, and the only query setting retained by a classic saved query is the SQL version. This setting governs whether the query uses legacy SQL or GoogleSQL. To query the data, users must have access to the data that the saved query accesses. For more information, see Grant access to saved queries.
There are 3 types of classic saved queries:
- Personal. Personal classic saved queries are visible only to the user who creates them. They are identified with the icon.
- Project-level. Project-level saved queries are visible to principals that have the required permissions. They are identified with the icon.
- Public. Public classic saved queries are visible to anyone with a link to the query. They are identified with the icon.
You can migrate classic saved queries to saved queries to take advantage of the new capabilities, or continue to maintain them as classic saved queries until 2025.
The classic saved query feature is available only in the Google Cloud console.
Deprecation of classic saved queries
By March 2025, the saved queries feature of BigQuery Studio will replace classic saved queries. To edit existing classic saved queries after 2024, you must migrate classic queries to BigQuery Studio saved queries.
If users, including yourself, have personal queries with information that shouldn't be made available to others with access to data in the project, then the query's owner must delete the queries or the information by March 2025.
To support this transition, the following BigQuery IAM roles were updated in February 2024:
BigQuery Admin (
roles/bigquery.admin
) will get Dataform Admin (roles/dataform.admin
) permissions.BigQuery Job User (
roles/bigquery.jobUser
) will get the following permissions:dataform.locations.get
dataform.locations.list
dataform.repositories.create
dataform.repositories.list
BigQuery User (
roles/bigquery.user
) will get the following permissions:dataform.locations.get
dataform.locations.list
dataform.repositories.create
dataform.repositories.list
To let users without the BigQuery Admin, BigQuery Job User, or BigQuery User roles use saved queries, grant them the required permissions in IAM.
Custom roles won't be automatically updated. To update a custom role with the required permissions, see Edit an existing custom role.
What's next
- To learn how to create saved queries, see Create saved queries.
- To learn how to manage saved queries, see Manage saved queries.