BigQuery interview questions and answers, from bytes scanned to slots
BigQuery interview questions check whether you understand what a query reads, because columnar storage, partitioning and clustering decide how many bytes are scanned and how much slot time a query uses. Expect questions on partitioned and clustered table design, nested STRUCT and ARRAY fields with UNNEST, deduplication and MERGE, loading versus streaming, and keeping cost under control by design rather than by luck. Senior data engineers are also asked to read a query plan and fix slow or expensive jobs.
By Evin JohnPublished 7 min read
How BigQuery comes up in interviews
BigQuery questions appear in data engineer, analytics engineer and data analyst interviews at companies on Google Cloud, and in any team that receives Google Analytics 4 or ad platform exports. Analyst rounds focus on SQL that works with nested data. Engineering rounds add table design, ingestion, orchestration and cost. A frequent opener is a slow or expensive query on screen with the question: what is wrong and what would you change?
- ScreenWhat makes BigQuery different from a row-store database, how pricing models work in general terms, partitioning versus clustering.
- SQL roundWindow functions, deduplication, UNNEST on nested events, date logic and sometimes a MERGE for an incremental load.
- Design and optimizationModel a table for a stated query pattern, plan ingestion, read an execution plan and cut bytes scanned or slot time.
Fundamentals: architecture and how cost works
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What does serverless mean for BigQuery? | Architecture | You do not size or manage a cluster. Storage and compute are separate: data sits in managed columnar storage, and queries borrow compute from a shared pool when they run. |
| Why does columnar storage matter for queries? | Storage format | Each column is stored and compressed separately, so a query reads only the columns it names. Selecting three columns from a wide table reads a fraction of the data that SELECT * would. |
| What is a slot? | Compute | A unit of compute (roughly a virtual CPU with memory) that BigQuery uses to run query stages in parallel. Queries are split into stages and work units that slots execute. |
| What are the two broad pricing models? | Cost model | On-demand charges by bytes processed per query. Capacity-based pricing reserves slot capacity and charges for it over time regardless of bytes. Teams pick based on how steady and how large their workload is. |
| Does adding LIMIT 10 make a query cheaper? | Bytes scanned | Usually not under on-demand pricing: the columns are still read before the limit applies. Partition filters, fewer columns and clustering are what reduce bytes. |
| How do you know what a query will read before running it? | Dry run | A dry run returns the estimated bytes processed without running it. The console shows the same estimate before you click run. |
| How is BigQuery different from Cloud SQL or Postgres? | Fit | It is built for large scans and aggregations, not for many small transactional reads and writes. Single-row updates are slow and quota-limited compared with an OLTP database. |
| What is a dataset? | Organization | A container for tables and views within a project, with a location (region or multi-region) and access controls. Queries cannot join across locations. |
Partitioning and clustering
CREATE TABLE analytics.events (
event_ts TIMESTAMP NOT NULL,
user_id STRING,
event_name STRING,
country STRING,
device STRUCT<category STRING, os STRING>,
params ARRAY<STRUCT<key STRING, value STRING>>
)
PARTITION BY DATE(event_ts)
CLUSTER BY event_name, country, user_id
OPTIONS (
require_partition_filter = TRUE,
partition_expiration_days = 400
);
-- Reads only seven daily partitions, and clustering prunes blocks by event_name.
SELECT country, COUNT(DISTINCT user_id) AS buyers
FROM analytics.events
WHERE DATE(event_ts) BETWEEN '2026-11-01' AND '2026-11-07'
AND event_name = 'purchase'
GROUP BY country
ORDER BY buyers DESC;| Question | What it tests | What a strong answer shows |
|---|---|---|
| What is the difference between partitioning and clustering? | Table design | Partitioning splits a table into segments by a date, timestamp or integer range, and a filter on that column skips whole partitions with a known cost estimate. Clustering sorts data within partitions by up to four columns, so filters on them skip blocks. |
| Which partitioning types exist? | Options | Time-unit column partitioning (hour, day, month, year), ingestion-time partitioning, and integer-range partitioning. |
| Why does the order of clustering columns matter? | Pruning | Data is sorted by the first column, then the second within it, and so on. Filters on the leading column prune the most; a filter only on the third column helps less. |
| When should you not partition? | Over-partitioning | When partitions would be tiny, such as hourly partitions on a small table, or when there would be too many: tables have a cap on partition count. Clustering alone can be the better fit. |
| What does require_partition_filter do? | Guardrails | It rejects queries that do not filter on the partition column, which stops accidental full-table scans. |
| Partitioned table or date-sharded tables such as events_20261101? | Legacy patterns | One partitioned table is preferred: fewer tables, simpler queries and better planning. Sharded tables still appear in some exports, including GA4, and are queried with a wildcard and a filter on the table suffix. |
| Why might a filter not prune partitions? | Query shape | Filtering on a value computed from a subquery, or wrapping the partition column in a function the planner cannot use, can stop pruning. Check bytes processed in the dry run. |
Nested and repeated fields
SELECT
e.user_id,
e.event_ts,
e.device.category AS device_category,
(SELECT p.value FROM UNNEST(e.params) AS p WHERE p.key = 'page') AS page
FROM analytics.events AS e
WHERE DATE(e.event_ts) = '2026-11-30'
AND e.event_name = 'page_view';
-- One row per parameter, keeping events with an empty array:
SELECT e.event_name, p.key, p.value
FROM analytics.events AS e
LEFT JOIN UNNEST(e.params) AS p
WHERE DATE(e.event_ts) = '2026-11-30';- What are STRUCT and ARRAY in BigQuery? A STRUCT groups named fields, like a record. An ARRAY holds repeated values of one type. A column of arrays of structs is the nested, repeated shape that event exports use.
- Why nest instead of normalizing into separate tables? Data read together is stored together, so you avoid a large join at query time. Order lines inside an order row are the classic case.
- What is the difference between CROSS JOIN UNNEST and LEFT JOIN UNNEST? The comma or CROSS JOIN form drops rows whose array is empty or NULL. LEFT JOIN UNNEST keeps them with NULL values.
- How do you build an array in a query? ARRAY_AGG, often with ORDER BY and LIMIT inside it, such as the last five orders per customer.
- Why do analysts double-count after UNNEST? Unnesting multiplies rows, so a SUM of an order-level field now counts it once per item. Aggregate before unnesting or use the right grain.
SQL patterns BigQuery interviews like
MERGE warehouse.customers AS t
USING (
SELECT *
FROM staging.customer_changes
WHERE DATE(updated_at) >= DATE_SUB(CURRENT_DATE(), INTERVAL 3 DAY)
QUALIFY ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) = 1
) AS s
ON t.customer_id = s.customer_id
WHEN MATCHED AND s.updated_at > t.updated_at THEN
UPDATE SET email = s.email, plan = s.plan, updated_at = s.updated_at
WHEN NOT MATCHED THEN
INSERT (customer_id, email, plan, updated_at)
VALUES (s.customer_id, s.email, s.plan, s.updated_at);- What does QUALIFY do? It filters on the result of a window function, the way HAVING filters on aggregates, so you do not need a subquery around ROW_NUMBER.
- When are approximate functions acceptable? APPROX_COUNT_DISTINCT and approximate quantiles are much cheaper on huge data and fine for dashboards and exploration. Billing, finance and anything audited need exact counts.
- How do you handle late-arriving data in an incremental load? Reprocess a lookback window, as the three days above, and make the MERGE idempotent with a timestamp guard so replays do not overwrite newer data.
- How do you write a slowly changing dimension type 2 in BigQuery? A MERGE that closes the current row (sets an end date and a current flag) and inserts a new version, or a dbt snapshot that does the same.
- What is a common cause of a query that never finishes? An accidental many-to-many join or a cross join that explodes row counts. Check join keys for uniqueness first.
Loading, performance, security and cost control
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Batch load or streaming? | Ingestion | Batch load jobs from Cloud Storage suit hourly or daily files in Avro or Parquet. The Storage Write API suits low-latency streams, with exactly-once options. Older insertAll streaming still exists in many codebases. |
| How do you read a query execution plan? | Performance | Look at stages for the most slot time, bytes shuffled and skew between average and maximum worker time. A stage with a huge maximum usually points to a skewed join key. |
| How do you speed up a join between a big fact table and a small dimension? | Joins | Filter and pre-aggregate the big side first, keep the small side small so it can be broadcast, and join on clustered keys where possible. |
| What are materialized views good for? | Precomputation | Repeated aggregations over a growing base table. BigQuery keeps them updated incrementally and can rewrite matching queries to use them. |
| How do you see who is spending the most? | Cost governance | Query the INFORMATION_SCHEMA jobs views for bytes billed and slot time by user, project and query, then add labels to jobs for attribution. |
| What guardrails would you set for a team of analysts? | Cost control | Maximum bytes billed per query, required partition filters, custom quotas per user or project, authorized views on curated tables and training on SELECT * habits. |
| How do you restrict access to sensitive columns or rows? | Security | Dataset and table IAM, authorized views, row-level access policies, and column-level security with policy tags and data masking for fields such as email. |
| How do you recover a table someone overwrote? | Recovery | Time travel lets you query or restore a table as of an earlier time within a configurable window of up to about a week; snapshots give longer-lived copies. |
Fictional example
- Interviewer
- The query uses SELECT *, filters with WHERE FORMAT_DATE('%Y-%m', DATE(event_ts)) = '2026-11', and the table is partitioned by day. The dashboard refreshes every 15 minutes.
- Candidate
- Two things stand out. SELECT * reads every column, including the params array, which is probably the biggest. I would list only the five columns the chart uses. Second, the filter formats the date into a string, which may stop the planner from pruning partitions; I would rewrite it as a range on the partition column, DATE(event_ts) between the first and last day of the month. I would confirm both with a dry run and compare bytes processed. Then, because the dashboard asks the same aggregate every 15 minutes, a materialized view or a small summary table refreshed by a scheduled query would serve it with far less data. Last, I would turn on require_partition_filter so the next dashboard cannot repeat the mistake.
Ten-day BigQuery practice plan
- Days 1 and 2: use the public datasets in a sandbox project and compare bytes processed for SELECT * versus named columns.
- Days 3 and 4: create a partitioned and clustered copy of a public table and measure pruning with dry runs.
- Days 5 and 6: practice UNNEST, ARRAY_AGG and STRUCT queries on a nested events dataset until double-counting stops surprising you.
- Day 7: write a deduplicating MERGE with a lookback window and run it twice to prove it is idempotent.
- Days 8 and 9: open execution plans for a slow join and a skewed aggregation and describe them out loud.
- Day 10: rehearse the cost and security questions out loud, focusing on what drives bytes and slot time.
For the wider platform, see Google Cloud (GCP) interview questions; for another cloud warehouse with a different compute model, see Snowflake interview questions. Pipelines that load BigQuery from other clouds often run in Azure Data Factory, and operational data frequently arrives from stores like DynamoDB. The role-level view is in data engineer interview questions.
SQL rounds go better when you have heard yourself explain a plan before. Natively, an AI interview assistant for Mac and Windows, transcribes your mock BigQuery session on your computer, so you can check whether you mentioned bytes scanned before rewriting the query. In practice it can read a query or an execution plan from a screenshot and suggest changes, and with Pro or the free trial it uses the résumé and job description you add. The transcript and notes are saved for review.
Questions people ask
What BigQuery questions are asked in interviews?
Expect the serverless architecture and columnar storage, on-demand versus capacity pricing in general terms, partitioning versus clustering, nested STRUCT and ARRAY fields with UNNEST, QUALIFY and MERGE, loading versus streaming, query plans and cost controls.
What is the difference between partitioning and clustering in BigQuery?
Partitioning splits a table by a date, timestamp or integer range so filters skip whole partitions. Clustering sorts data inside partitions by up to four columns so filters on those columns skip blocks.
How do you reduce BigQuery query cost?
Select only the columns you need, filter on the partition column, cluster on common filters, use dry runs and a maximum bytes billed limit, and precompute repeated aggregates in materialized views or summary tables.
What is a slot in BigQuery?
A slot is a unit of compute that BigQuery uses to run parts of a query in parallel. On-demand queries draw from a shared pool, while capacity-based pricing reserves a set amount of slots.
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.
