GCP BigQuery interview questions and answers for data roles

BigQuery interview questions test whether you can write SQL that is correct and cheap on a serverless, columnar warehouse where storage and compute are separate and cost follows bytes scanned or slots reserved. Expect questions on partitioning and clustering, nested and repeated fields with UNNEST, window functions and QUALIFY, MERGE for upserts, loading versus streaming, and security features such as authorized views and row-level policies. Senior rounds bring cost spikes, slow queries and pipeline design.

By Published 8 min read

Who gets BigQuery questions

BigQuery is Google Cloud's data warehouse, and companies that use it ask about it directly in data engineer, analytics engineer, BI developer and data analyst loops. Analysts get mostly SQL. Engineers also get table design, ingestion and cost. Because pricing depends on what a query reads or on reserved compute, interviewers treat cost awareness as part of correctness. For the rest of the platform (projects, IAM, networking, Pub/Sub and Dataflow), see GCP interview questions.

  1. SQL screenWindow functions, deduplication, top-N per group, sessionization and date handling, usually in a shared editor.
  2. Warehouse conceptsHow BigQuery stores and processes data, partitioning versus clustering, nested fields and what drives cost.
  3. Pipeline and modelingDesign ingestion and tables for a product's event data, including late data, upserts and backfills.
  4. ScenariosA bill that tripled, a query that times out, a dashboard that is slow every morning, a dataset that must be shared safely.

BigQuery fundamentals questions

Concepts for every level
QuestionWhat it testsWhat a strong answer shows
How is BigQuery different from PostgreSQL or MySQL?Workload fitIt is built for scanning and aggregating huge tables, storing each column separately and running queries across many workers. It is not meant for high rates of single-row updates or transactional apps.
What does "storage and compute are separated" mean?ArchitectureData sits in Google's distributed storage, and queries borrow compute only while they run. You can store a lot cheaply and scale query capacity independently.
What is a slot?Compute unitA unit of query processing capacity. Queries are split into stages that run on slots in parallel. Capacity pricing reserves slots; on-demand pricing draws from a shared pool.
On-demand versus capacity pricing?Cost modelsOn-demand bills by bytes processed per query. Capacity pricing (reservations, through BigQuery editions) bills for slot capacity over time. Steady heavy workloads often move to capacity; spiky light ones stay on-demand.
Does adding LIMIT 10 make a query cheaper?Columnar costUsually not on-demand: the bytes scanned depend on the columns and partitions read, not on rows returned. Clustering can let a LIMIT stop earlier, but do not rely on it.
Why avoid SELECT * ?Cost and speedEvery extra column is read and billed. Select the columns you need; for exploration use the table preview, which does not run a query.
What is a dry run?EstimationA query validated without executing, returning the bytes it would process. Useful in code review and CI for expensive queries.
What are datasets and projects in BigQuery?OrganizationA project holds billing and permissions; a dataset is a container of tables and views with a location. Datasets in different locations cannot be joined in one query.
Are query results cached?CachingIdentical queries on unchanged tables can return cached results for a period without billing again, unless the query uses non-deterministic functions or caching is turned off.
What are STRUCT and ARRAY types for?Nested dataA STRUCT groups fields; an ARRAY holds repeated values. An order row can carry its line items as an array of structs, avoiding a join to a separate table.
Concepts for every level. Scroll sideways on a small screen.

Table design: partitioning, clustering and nesting

  • What can you partition on? A DATE, TIMESTAMP or DATETIME column, ingestion time, or an integer range. Queries that filter on the partition column skip whole partitions, which cuts bytes and time.
  • What does require_partition_filter do? It rejects queries on the table that have no filter on the partition column, which protects large tables from accidental full scans.
  • When does clustering help? When queries filter or aggregate on a few columns with many distinct values, such as customer or country. BigQuery sorts storage blocks by those columns so it can skip blocks. The column order matters, like a composite index.
  • Partition or cluster on customer_id? Usually cluster. Partitioning on a high-cardinality column creates far too many small partitions; partition by date and cluster by customer.
  • Why can too many tiny partitions hurt? Each partition carries metadata and overhead, and very small partitions read inefficiently. Daily partitions on a low-volume table are often worse than monthly ones.
  • Nest or normalize? Nest data that is always read with its parent (order lines in an order) to save a join and keep the row together. Keep separate tables for entities with their own life cycle, such as customers.
  • What are sharded tables (events_20261101) and why are they discouraged now? Older pipelines made one table per day and queried them with wildcard tables. Partitioned tables do the same job with less metadata, one schema and simpler permissions.
  • How do you handle schema changes? Adding nullable columns is easy. Renames and type changes usually mean a new column, a backfill and a switch, or a view that hides the change from consumers.
CREATE TABLE shop.orders (
  order_id STRING,
  customer_id STRING,
  created_at TIMESTAMP,
  items ARRAY<STRUCT<sku STRING, qty INT64, unit_price NUMERIC>>
)
PARTITION BY DATE(created_at)
CLUSTER BY customer_id
OPTIONS (require_partition_filter = TRUE);

-- Revenue per SKU for one week: UNNEST turns each array element into a row.
SELECT item.sku, SUM(item.qty * item.unit_price) AS revenue
FROM shop.orders AS o, UNNEST(o.items) AS item
WHERE DATE(o.created_at) BETWEEN '2026-11-01' AND '2026-11-07'
GROUP BY item.sku
ORDER BY revenue DESC;
BigQuery DDL and nested data: a partitioned, clustered table that refuses unfiltered scans, and a query that flattens line items with UNNEST. BigQuery syntax, not executed here.

BigQuery SQL questions

SQL patterns asked in screens
QuestionWhat it testsWhat a strong answer shows
Deduplicate rows, keeping the latest per key.Window functionsROW_NUMBER over the key ordered by timestamp descending, then keep row 1. In BigQuery, QUALIFY filters on the window result without a subquery.
Top three products per category.RankingRANK, DENSE_RANK or ROW_NUMBER partitioned by category, and say how ties should be treated before choosing.
Group events into sessions with a 30-minute gap.LAG and running sumsFlag rows where the gap from the previous event exceeds the limit, then a running SUM of the flags gives a session number per user.
Upsert a daily batch into a target table.MERGEMERGE on the business key with WHEN MATCHED THEN UPDATE and WHEN NOT MATCHED THEN INSERT; deduplicate the source first or the MERGE fails on multiple matches.
Count distinct users over billions of rows quickly.ApproximationAPPROX_COUNT_DISTINCT trades a small, documented error for much less memory and time; say when exact counts are required, such as billing.
Cast a messy string column safely.RobustnessSAFE_CAST returns NULL instead of failing the whole query, and the nulls can then be counted and reported.
Filter on a JSON field.Semi-structured dataUse the JSON type or JSON functions to extract values, and promote frequently filtered fields to real columns for speed and cost.
Running total per account by day.Window framesSUM over a window partitioned by account and ordered by date; know the default frame and when to state ROWS BETWEEN explicitly.
SQL patterns asked in screens. Scroll sideways on a small screen.
SELECT order_id, status, updated_at
FROM (
  SELECT *,
         ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY updated_at DESC) AS rn
  FROM orders_raw
) AS ranked
WHERE rn = 1
ORDER BY order_id;

-- The same filter in BigQuery with QUALIFY (BigQuery syntax, not executed here):
-- SELECT * FROM orders_raw
-- WHERE TRUE
-- QUALIFY ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY updated_at DESC) = 1;
Keep the latest row per order. Plain ANSI SQL that BigQuery accepts; run in SQLite it returns A1 | paid and B7 | created, with the duplicate paid row collapsed to one.
WITH flagged AS (
  SELECT
    user_id,
    ts,
    IF(
      LAG(ts) OVER (PARTITION BY user_id ORDER BY ts) IS NULL
      OR TIMESTAMP_DIFF(ts, LAG(ts) OVER (PARTITION BY user_id ORDER BY ts), MINUTE) > 30,
      1, 0
    ) AS is_new_session
  FROM analytics.events
  WHERE DATE(ts) = '2026-11-01'
)
SELECT
  user_id,
  ts,
  SUM(is_new_session) OVER (PARTITION BY user_id ORDER BY ts) AS session_number
FROM flagged;
Sessionization in BigQuery dialect. The logic was checked with an equivalent SQLite query: events at 10:00 and 10:10 share session 1 and 11:30 starts session 2.

Loading, security and features questions

  • Batch load, streaming or the Storage Write API? Batch load jobs from Cloud Storage suit files arriving on a schedule. The Storage Write API is the recommended way to stream rows in, with exactly-once options. The older streaming inserts API still exists in many pipelines. Pick by latency need and how duplicates are handled.
  • What file formats load best? Self-describing columnar or binary formats such as Avro and Parquet keep types and load fast. CSV and JSON work but need schema care, quoting rules and type checks.
  • How do external tables differ from native ones? External tables query files in Cloud Storage or other sources in place, which avoids copying but is usually slower and has fewer optimizations. Native tables are better for heavy, repeated queries.
  • How do you share data with another team without exposing the whole table? An authorized view or authorized dataset exposes only the query result. Row-level access policies limit rows by user, and policy tags with column-level security or data masking protect sensitive columns.
  • What are materialized views for? Precomputed results of a query that BigQuery keeps up to date incrementally, and can use automatically to answer matching queries on the base table. They suit repeated aggregations behind dashboards.
  • How do you recover from a bad update? Time travel lets you query or restore a table as of a recent point in time, within the configured window. Table snapshots keep a cheap point-in-time copy for longer.
  • What is BigQuery ML? Training and running some model types with SQL (CREATE MODEL, ML.PREDICT) inside the warehouse, useful for quick baselines without moving data out.

Senior BigQuery and scenario questions

Production scenarios
ScenarioLikely causeWhat to say you would check
The monthly BigQuery bill tripled.New expensive queriesQuery INFORMATION_SCHEMA.JOBS by user and total bytes processed or slot time. Look for scheduled queries or dashboards scanning unpartitioned tables, then add partition filters, byte limits and clustering.
A join runs for an hour and spills.Skew or explosionOne key with far more rows than others, or a many-to-many join multiplying rows. The query plan shows the slow stage; pre-aggregate or filter before the join and check join keys for duplicates.
Morning dashboards are slow and queue.Slot contentionMany scheduled jobs start at once on a fixed reservation. Stagger them, move heavy refreshes earlier, or use materialized views and BI acceleration for the dashboard.
Duplicate rows appear after a pipeline retry.At-least-once ingestionRetries replayed a batch. Use idempotent loads (MERGE on a key, or write to a staging table and swap) and the exactly-once mode of the Storage Write API where it fits.
A scheduled query failed silently for a week.Monitoring gapNo alerting on job failures or on table freshness. Add freshness checks on key tables and alerts on failed jobs.
An analyst ran a full scan of a huge table by mistake.GuardrailsRequire partition filters, set maximum bytes billed on projects or users, and use custom quotas per user or project.
Production scenarios. Scroll sideways on a small screen.
SELECT
  user_email,
  COUNT(*) AS jobs,
  ROUND(SUM(total_bytes_processed) / POW(1024, 4), 2) AS tib_processed,
  ROUND(SUM(total_slot_ms) / (1000 * 60 * 60), 1) AS slot_hours
FROM `region-us`.INFORMATION_SCHEMA.JOBS
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
  AND job_type = 'QUERY'
GROUP BY user_email
ORDER BY tib_processed DESC
LIMIT 20;
Who and what is driving cost over the last week, from job metadata. BigQuery syntax and region qualifier shown as an example; not executed here.

Fictional example

Answering "Design the events table for a mobile app's analytics"
Interviewer
The app sends a few hundred million events a day. Analysts mostly look at the last 30 days by event name and country. How would you set it up?
Candidate
I would land raw events through the Storage Write API into a table partitioned by event date and clustered by event name and country, matching the common filters. Event parameters vary by event, so I would keep them as a repeated key-value field or JSON and promote the few that analysts filter on into real columns. I would set require_partition_filter so nobody scans the whole history by accident, and a partition expiration only if the raw table is not the system of record. On top, a daily model builds smaller summary tables for dashboards, and I would check bytes processed on the top queries a week after launch to confirm the clustering choice was right.

BigQuery practice plan

  • Days 1 and 2: use the free public datasets in the BigQuery sandbox. Run the same query with and without a partition filter and with fewer columns, and note bytes processed each time.
  • Days 3 and 4: window function drills: dedupe, top-N per group, sessions, running totals, each written twice (subquery and QUALIFY).
  • Day 5: build a nested table with an array of structs and query it with UNNEST; then write a MERGE that upserts a batch.
  • Day 6: read a query plan for a slow join and explain each stage; write an INFORMATION_SCHEMA cost query.
  • Day 7: mock design round: an events pipeline from ingestion to dashboards, covering late data, duplicates, cost guardrails and access control.

App teams often reach BigQuery through Firebase exports, covered in Firebase interview questions; general SQL drills sit in SQL interview questions.

Warehouse interviews reward saying the cost of a query before you are asked, and a transcript shows quickly whether you did. Natively, an AI interview assistant for Mac and Windows, writes down a mock SQL or design round as you speak, on your own computer, so you can count how often you mentioned partitions and bytes. In practice it can read a query or a plan from a screenshot and suggest a cheaper shape, and with Pro or the free trial it can use your résumé and the job description you add. Each session's notes stay available afterward.

Questions people ask

What BigQuery questions are asked in data engineer interviews?

How storage and compute are separated, slots, on-demand versus capacity pricing, partitioning versus clustering, nested and repeated fields, MERGE for upserts, loading versus streaming, authorized views and how to investigate a cost spike.

What is the difference between partitioning and clustering in BigQuery?

Partitioning splits a table by a date, timestamp or integer range so queries skip whole partitions. Clustering sorts data inside the table by up to a few chosen columns so filters on them read fewer blocks. A common design partitions by date and clusters by a high-cardinality filter column.

How do you reduce BigQuery query cost?

Select only needed columns, filter on the partition column, cluster on common filters, use dry runs and maximum bytes billed, precompute repeated aggregates in materialized or summary tables, and review job history in INFORMATION_SCHEMA.

What SQL is asked in BigQuery interviews?

Window functions for deduplication, top-N per group, sessionization and running totals, QUALIFY, UNNEST over arrays of structs, MERGE, approximate distinct counts and safe casting.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP