Request a demo

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 · Google · US · Sizes measured November 23, 2026

7tables
337 GiBlogical size
643,021,667rows
$2.06to scan every column once, on-demand

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

TableRowsSizeFull scanLayout
trigrams
Word trigrams with counts per volume in the repeated `cell` record.
68,051,509258 GiB$1.58None
wikipedia
Wikipedia revision history.
313,797,03535.7 GiB$0.22None
natality
US birth records.
137,826,76321.9 GiB$0.13None
gsod
Daily weather station summaries.
114,420,31616.1 GiB$0.10None
github_timeline
GitHub events, flattened into columns.
6,219,7493.5 GiB$0.02None
github_nested
GitHub events with nested records.
2,541,6391.6 GiBunder $0.01None
shakespeare
Word counts per work of Shakespeare.
164,6566.1 MiBunder $0.01None

Full scan = every column of the table at the on-demand list price of $6.25 per TiB, before your free TiB each month. Selecting fewer columns costs proportionally less. See BigQuery pricing.

Example queries

Most used words in Shakespeare

Scans 2.5 MiB · under $0.01 on-demand

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)

Scans 21.9 GiB · $0.13 on-demand

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

Scans 2.1 GiB · $0.01 on-demand

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

Scans 1.8 GiB · $0.01 on-demand

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"

Scans 2.4 GiB · $0.01 on-demand

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 WHERE and LIMIT do not reduce bytes.
  • trigrams is 258 GiB and nearly all of it is the cell record. Query ngram and 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.
  • shakespeare is 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.

All public datasets · BigQuery cost queries · Pricing calculator

Cut BigQuery spend without guessing

Masthead attributes compute and storage cost to every project, user, pipeline and table, finds unused and dead-end tables, and shows where editions or on-demand pricing is cheaper. Mnemonic cut its BigQuery compute cost by 20% within 24 hours of onboarding.