Public dataset · Web, code and analytics
Google Trends in BigQuery
The google_trends dataset publishes Google's top 25 and top 25 rising search terms each day, for US metro areas and for regions in other countries. Every table is partitioned by refresh_date: filtering on the latest refresh reads about 35 MiB, while skipping the filter reads 1.3 GiB for the same answer.
bigquery-public-data.google_trends exposes anonymized, aggregated and indexed search data from Google Trends, so you can query top terms in SQL instead of through the Trends website. It is published by Google and refreshed daily; all four tables were last modified on the day these sizes were measured.
top_terms is described as the daily top 25 terms in the United States with score, ranking, time and designated market area (DMA). top_rising_terms is the same for the fastest-rising terms and adds percent_gain. international_top_terms and international_top_rising_terms cover other countries, by country_code and region.
Each daily refresh lands in its own refresh_date partition and contains weekly rankings (week) for many past weeks, so the same term and week repeat across refreshes. Within a refresh, a term has one row per DMA or region, which is why the examples use DISTINCT for national rankings.
Tables and sizes
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
international_top_rising_termsTop rising terms by country and region. | 210,717,718 | 17.9 GiB | $0.11 | Partitioned: by day on refresh_date |
international_top_termsTop 25 terms by country and region. | 204,310,105 | 15.4 GiB | $0.09 | Partitioned: by day on refresh_date |
top_rising_termsDaily top rising terms in the US, with percent gain, by DMA. | 39,842,250 | 3.0 GiB | $0.02 | Partitioned: by day on refresh_date |
top_termsDaily top 25 terms in the US, with score and rank, by DMA. | 37,480,800 | 2.6 GiB | $0.02 | Partitioned: by day on refresh_date |
Example queries
Top 25 US search terms for the latest week
refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) is a constant expression, so BigQuery reads one partition. The subquery picks the newest week inside that refresh.
SELECT DISTINCT term, rank
FROM `bigquery-public-data.google_trends.top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
AND week = (
SELECT MAX(week)
FROM `bigquery-public-data.google_trends.top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
)
ORDER BY rank;The same list without a refresh_date filter (expensive)
Every partition is read, and terms from older refreshes mix in. It costs about 38 times more than the filtered version.
SELECT DISTINCT term, rank
FROM `bigquery-public-data.google_trends.top_terms`
WHERE week = (SELECT MAX(week) FROM `bigquery-public-data.google_trends.top_terms`)
ORDER BY rank;Fastest-rising US terms in the latest refresh
SELECT term, MAX(percent_gain) AS percent_gain
FROM `bigquery-public-data.google_trends.top_rising_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
GROUP BY term
ORDER BY percent_gain DESC
LIMIT 25;The number one term in every US metro area
SELECT dma_name, term, score
FROM `bigquery-public-data.google_trends.top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
AND week = (
SELECT MAX(week)
FROM `bigquery-public-data.google_trends.top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
)
AND rank = 1
ORDER BY dma_name;Top terms in the United Kingdom
The international tables are about six times larger than the US ones, so the refresh_date filter matters even more here.
SELECT DISTINCT term, rank
FROM `bigquery-public-data.google_trends.international_top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
AND country_code = 'GB'
ORDER BY rank
LIMIT 25;Querying it cheaply
- Always filter on
refresh_date. It is the partitioning column of every table and the only filter that reduces bytes. - Use a constant date such as
DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY). A filter likerefresh_date = (SELECT MAX(refresh_date) FROM ...)is dynamic, and BigQuery reads all partitions to evaluate it. - Filters on
country_code,dma_nameortermreturn fewer rows but do not reduce bytes, because the tables are not clustered. - If today's refresh has not landed yet, yesterday's partition is the newest. Checking with a dry run costs nothing: an empty partition reports 0 bytes.
FAQ
How much does it cost to query Google Trends in BigQuery?
A query on one refresh of the US tables reads about 35 to 50 MiB, and one refresh of an international table a few hundred MiB. Without a refresh_date filter, the US top terms table reads 1.3 GiB per query. All of these fit in the free 1 TiB a month.
Is the Google Trends dataset free?
Yes for storage: the table 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).
How often is the Google Trends dataset updated?
Daily. Each update adds a new refresh_date partition, and all four tables were last modified on the day these sizes were measured.
Why do I get duplicate terms from google_trends.top_terms?
A term appears once per DMA in each refresh, and again in every later refresh. Filter on a single refresh_date and week, and use DISTINCT term, rank for the national list.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
