In this article
BigQuery is Google Cloud's serverless data warehouse. You write SQL, and Google runs it over very large tables without you managing servers.
Quick summary
- You query tables with standard SQL.
- Google hosts public datasets you can practise on.
- Cost depends mainly on how much data a query scans.
- You can preview and dry-run a query before you run it.
Open BigQuery
In the Cloud console, search for BigQuery. The explorer on the left shows your projects and datasets. Public data is under the bigquery-public-data project.
Your first query
SELECT name, SUM(number) AS total
FROM `bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY name
ORDER BY total DESC
LIMIT 10;
This lists the ten most common baby names in that dataset. Press Run and the results appear below.
Keep costs low
BigQuery's on-demand pricing is based on the bytes your query processes, and there is a monthly free allowance. Habits that help:
- Select only the columns you need, not
SELECT *. - Use
LIMITfor exploring, but know that it does not always reduce the data scanned. - Check the estimate shown above the editor before you run a big query.
- Use the table Preview tab, which is free, to look at data.
Always check the official pricing page, because limits and prices can change.
Datasets, tables and projects
A dataset groups tables, and it lives in a project and a location. Names look like project.dataset.table. If a query says a table was not found, check the project, the dataset and the spelling. This is the same cause as in Google Cloud projects explained.
Why it matters for Arcade
Data and analytics skill badges use BigQuery heavily. If you are comfortable with SELECT, WHERE, GROUP BY and JOIN, the challenge labs go much faster. Pick one from the badge list, try it, and check your points.
Frequently asked questions
Is BigQuery free?
There is a free monthly query allowance and a sandbox for learning, but check the official pricing page because limits can change.
Does LIMIT reduce the cost of a query?
Not always. BigQuery bills mostly by the data scanned, so choose only the columns you need.
Which SQL does BigQuery use?
GoogleSQL, which is very close to standard SQL, so SELECT, WHERE, GROUP BY and JOIN work as you expect.