
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Query a public dataset in BigQuery
/ 50
Rerun your Query
/ 50
In this lab, you explore controlling your BigQuery costs by modifying quota.
BigQuery offers scalable, flexible pricing options to meet your technical needs and your budget.
With BigQuery, you can incur storage and query costs. In this lab, you explore query costs. For more information, see BigQuery pricing.
There are two pricing models for query costs in BigQuery:
On-demand: On-demand pricing is based on the amount of data processed by each query you run. This is the most flexible option.
Flat-rate: Flat-rate customers purchase dedicated resources for query processing and are not charged for individual queries. This option is predictable and is best for customers with fixed budgets.
In this section, you access the Google Cloud and BigQuery consoles.
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
The Welcome to BigQuery in the Cloud Console message box opens. This message box provides a link to the quickstart guide and the release notes.
The BigQuery console opens.
In this lab, you query the bigquery-public-data:wise_all_sky_data_release
public dataset. Learn more about this dataset from the blog post Querying the Stars with BigQuery GIS.
In the Query editor paste the following query:
Do not run the query. Instead, please answer the following question:
Processing large amounts of data without proper cost controls, even with simple queries like the above, can lead to unanticipated charges on your bill. To manage this, examine how BigQuery pricing works and how you can setup custom quotas for your teams.
Click Check my progress to verify the objective.
The first 1 TB of query data processed per month is free.
In this task, you update the BigQuery API quota to restrict the data processed in queries in your project.
The consumerQuotaLimits display your current query per day limits. There is a separate quota for usage per project and usage per user.
You should see the same limits from before but also a consumerOverride with the value used in the previous step:
Next, you will re-run your query with the updated quota.
In the Cloud Console, click BigQuery.
The query you previously ran should still be in the query editor, but if it isn't, paste the following query in the Query editor and click Run:
Note the validator still mentions This query will process 1.36 TB when run
. However, the query has run successfully and hasn't processed any data. Why do you think that is?
Queries that use cached query results are at no additional charge and do not count against your quota. For more information on using cached query results, see Using cached query results.
In order for us to test the newly set quota, you must to disable query cache to process data using the previous query.
Uncheck Use cached results and click Save.
Run the query again so that it counts against your daily quota.
Once the query has run successfully and processed the 1.36 TB, run the query once more.
What happened? Were you able to run the query? You should have received an error like the following:
Custom quota exceeded: Your usage exceeded the custom quota for QueryUsagePerUserPerDay, which is set by your administrator. For more information, see https://cloud.google.com/bigquery/cost-controls
Click Check my progress to verify the objective.
Quotas can be used for cost controls but it's up to your business to determine which quotas make sense for your team. This is one example of how to set quotas to protect from unexpected costs. One way to reduce the amount of data queried is to optimize your queries.
Learn more about optimizing BigQuery queries from the Control costs in BigQuery guide.
In this lab you completed the following tasks:
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated November 05, 2024
Lab Last Tested November 05, 2024
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one