Q&A-25A team has a fixed monthly revenue report and a second team exploring semi-structured clickstream events. Compare schema-on-write ETL and schema-on-read ELT for this use case on data quality and query performance.
Answer
Core. Split the estate by contract strength, not by tool preference. The revenue report has a known schema, a named consumer and a correctness obligation: write the schema at ingest. The clickstream exploration has unknown questions and no consumer contract: land the bytes raw and apply a schema at read time. The mistake is picking one of them for both workloads.
What actually differs. Schema-on-write validates and types at the boundary: the loader rejects or quarantines a record that does not match, and the sink stores typed columns with per-column statistics. Schema-on-read stores what arrived (JSON, or Parquet written by the producer) and applies types inside each query.
| schema-on-write (ETL) | schema-on-read (ELT) | |
|---|---|---|
| where types are enforced | ingest job | every query |
| new field arrives | pipeline change, often a backfill | visible immediately |
| bad record | rejected or quarantined at the boundary, counted | query error, or a silent NULL |
| pruning | column stats and partition pruning | only if the file format carries stats |
| who owns correctness | pipeline owner | every consumer |
Query performance. Parquet keeps min/max statistics per column chunk, so a filter on event_date skips row groups before their bytes are read. Raw JSON carries no such statistics: every query parses every byte it scans. BigQuery on-demand pricing bills bytes scanned ($6.25 per TB in US multi-region at the time of writing), so this lands directly on the bill.
Illustrative arithmetic: 2 TB/day of raw events, a dashboard over 30 days. Reading raw JSON scans 60 TB → $375 per run. The same events written to Parquet partitioned by date and clustered by user_id, with the dashboard touching 400 GB → $2.50. Same data, same question, roughly 150× the cost. The absolute numbers are hypothetical; the ratio is what pruning alone buys you.
Data quality. Schema-on-write gives one enforcement point and one place to count rejects. Schema-on-read gives none. Consumer A reads user_id as INT64, consumer B as STRING, and both queries succeed. The failure is silent: a type drift upstream turns a join key into NULLs and the dashboard shows a dip rather than an error. Detect it with assertions on the read layer (Dataform assertions run as part of the pipeline and fail the run), null-rate and row-count monitors, and column-level lineage (OpenLineage) to find which consumers a drift touches.
Streaming makes schema-on-read worse. Spark Structured Streaming's JSON inference requires a full pass over the data and is documented as unsuitable for production; you supply an explicit StructType and handle the mismatched rows yourself.
When not to. Do not schema-on-write exploratory data: you will rebuild the pipeline every sprint. Do not schema-on-read anything with a contractual consumer or a regulatory obligation. The usual landing pattern is bronze raw (schema-on-read, immutable, replayable) → silver typed (schema-on-write, validated, partitioned) → gold marts, where the silver step pays the validation cost once instead of on every query.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.