Public dataset · Machine learning and samples
BigQuery Samples in BigQuery
The samples dataset is Google's set of practice tables for learning BigQuery: Shakespeare word counts, US births, weather station summaries, GitHub events, Wikipedia revisions and book trigrams. Sizes range from 6 MiB to 258 GiB, so the same dataset teaches both free queries and expensive ones.
bigquery-public-data.samples is described as a collection of tables that are subsets of larger datasets, suited for testing queries and learning BigQuery. Google publishes it, and the dataset description gives 2020-12-02 as its last update. Most tables were created in March 2016 and have not changed since; wikipedia was last modified in August 2025.
shakespeare lists each word with its count in each work and is the smallest table. natality holds US birth records with the baby's weight, the parents' ages and the state. gsod is daily weather station summaries in the shape of NOAA's Global Surface Summary of the Day. github_timeline and github_nested hold the same kind of GitHub event data, flat and nested. wikipedia is page revision history with contributor and timestamp. trigrams holds word trigrams with per-volume counts in a repeated cell record. No table is partitioned or clustered.
Tables and sizes
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
trigramsWord trigrams with counts per volume in the repeated `cell` record. | 68,051,509 | 258 GiB | $1.58 | None |
wikipediaWikipedia revision history. | 313,797,035 | 35.7 GiB | $0.22 | None |
natalityUS birth records. | 137,826,763 | 21.9 GiB | $0.13 | None |
gsodDaily weather station summaries. | 114,420,316 | 16.1 GiB | $0.10 | None |
github_timelineGitHub events, flattened into columns. | 6,219,749 | 3.5 GiB | $0.02 | None |
github_nestedGitHub events with nested records. | 2,541,639 | 1.6 GiB | under $0.01 | None |
shakespeareWord counts per work of Shakespeare. | 164,656 | 6.1 MiB | under $0.01 | None |
Example queries
Most used words in Shakespeare
The classic first BigQuery query. It reads 2.5 MiB and bills the 10 MB minimum.
SELECT word, SUM(word_count) AS uses
FROM `bigquery-public-data.samples.shakespeare`
GROUP BY word
ORDER BY uses DESC
LIMIT 20;SELECT * on natality with a filter and LIMIT (expensive)
Returns only 100 rows, but SELECT * reads all 31 columns of all 138 million rows. Neither WHERE year = 2005 nor LIMIT reduces bytes on an unpartitioned table.
SELECT *
FROM `bigquery-public-data.samples.natality`
WHERE year = 2005
LIMIT 100;Average birth weight per year, reading two columns
Aggregates every row and still reads about 10 times fewer bytes than the 100-row SELECT *.
SELECT
year,
ROUND(AVG(weight_pounds), 2) AS avg_weight_lb,
COUNT(*) AS births
FROM `bigquery-public-data.samples.natality`
GROUP BY year
ORDER BY year;Stations and thunderstorm days per year
Three narrow columns of the 16 GiB weather table.
SELECT
year,
COUNT(DISTINCT station_number) AS stations,
COUNTIF(thunder) AS station_days_with_thunder
FROM `bigquery-public-data.samples.gsod`
GROUP BY year
ORDER BY year;Trigrams that start with "data"
Reads the four string columns, about 1% of the table. Adding the repeated cell record would read most of its 258 GiB.
SELECT ngram, first, second, third
FROM `bigquery-public-data.samples.trigrams`
WHERE first = 'data'
LIMIT 20;Querying it cheaply
- Column choice is the only lever: no table is partitioned or clustered, so
WHEREandLIMITdo not reduce bytes. trigramsis 258 GiB and nearly all of it is thecellrecord. Queryngramand the word columns unless you need volume counts.- To preview rows without a scan, use the table preview in the console or
bq head, which are not billed. To experiment on a fraction of a large table, TABLESAMPLE reads only the sampled blocks. shakespeareis the cheapest table to practice on: any query on it bills the 10 MB minimum.
FAQ
How much does it cost to query bigquery-public-data.samples?
Queries on shakespeare bill the 10 MB minimum. Column-pruned queries on natality, gsod or trigrams read about 2 GiB. The most you can read is a full scan of trigrams, 258 GiB, about $1.57 at the $6.25 per TiB on-demand list price before the free TiB.
Is the BigQuery samples dataset free?
Yes for storage: the data sits in the bigquery-public-data project and Google pays to store it. You pay for the queries you run from your own project. On-demand, the first 1 TiB scanned each month is free, then you pay per TiB scanned (see BigQuery pricing).
Is the samples dataset kept up to date?
No. It is a fixed teaching set: most tables were created in 2016 and never changed. For current weather or GitHub data use the full public datasets, such as NOAA GSOD or GitHub Repos.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
