Exporting to a warehouse

Play this lesson

A question the reports can't answer

Firebase's built-in reports answer common questions. Theo, the studio's data analyst, has an uncommon one: do players who build in the editor defend more gardens the week after?

That needs every raw event in a data warehouse, a database built for questions across millions of rows. The Observe stage sent telemetry to storage tools and kept it only as long as needed. Analytics events need a home too.

Rows or columns

Shard Garden's game database loads one garden in milliseconds. Like most traditional databases, it stores each row's fields together. Google's BigQuery docs say that is efficient for looking up single records, but every field gets read.

BigQuery, Google's warehouse, stores each column separately. A question that needs two columns over a billion rows reads just those two. Values in one column are often alike, so they compress well too.

Quick check

Which job suits Theo's column-based warehouse best?

  1. Counting gardens defended each day for the last year
  2. Loading the save for garden 7f3a right now
  3. Changing one player's display name
Show the answer

Counting gardens defended each day for the last year

Counting across a year reads one or two columns over millions of rows, which columnar storage is built for. The other two touch single records, the job of the game database.

Linking Firebase to BigQuery

Google Analytics can export raw events to BigQuery:

Standard properties can export up to 1 million events a day, and exported data can't be exported again. Check the latest limits before planning.

Inside the export

Some columns of the export:

Theo writes one query that flattens this into a simpler table, events: one row per event, one column per parameter.

Read the schema

one row of the export
event_name  level_sharedevent_timestamp  1791729600000000event_date  20261011

What is 1791729600000000?

  1. Microseconds since 1970, in UTC
  2. Milliseconds, in the app's time zone
  3. The player's ID
Show the answer

Microseconds since 1970, in UTC

The export stores event_timestamp in microseconds, in UTC. event_date is in the app's registered time zone, so the two can disagree about the day.

Read less, pay less

In BigQuery, reading less data makes a query faster and cheaper. Its best-practice guide:

The free BigQuery sandbox needs no credit card. It gives 10 GiB of storage and 1 TiB of queries a month, and its tables expire after 60 days.

Quick check

Adding LIMIT 10 to SELECT * makes BigQuery read less data.

Show the answer

False

BigQuery's guide says LIMIT on SELECT * does not change the amount of data read. LIMIT shortens the answer, not the scan. Choosing fewer columns is what saves.

Keep it only as long as needed

The raw tables hold a pseudonymous ID for every install. Theo sets them to expire after 14 months. Counts with no IDs, like shares per day, can stay longer.

Asking the warehouse

The events are in one place, in one simple table. The language for asking it questions is older than the web.

Bolt says: Next: SQL, starting with SELECT and WHERE.

Fact-checked 11 October 2026