Data Warehousing and Data Lakes Questions
Architecture of warehouses, data lakes, and lakehouses: storage-compute separation, medallion/zoned layouts, and when each is appropriate. Covers governance of a lake, table formats, and the trade-offs between warehouse-first and lake-first analytics stacks. A core infrastructure-design topic for analytics platforms.
Why do analytical warehouses generally prefer columnar formats like Parquet or ORC over row-oriented storage? Explain the benefit in terms of how much data actually has to be read off disk, and how that connects to compression and to skipping columns a query doesn't need.
Sample Answer
Analytical warehouses prefer columnar formats like Parquet or ORC because most analytical queries touch a small number of columns across a huge number of rows, and columnar storage is built specifically to exploit that pattern. Row-oriented storage, by contrast, is built for the opposite pattern: reading or writing one whole record at a time.
Why columnar wins for analytics
In row-oriented storage, all the columns for a single row sit next to each other on disk, so reading even one column means reading the whole row. In columnar storage, all the values for a single column sit together instead. That single layout change explains most of the benefit:
Less data read off disk. If a query only needs three columns out of fifty, columnar storage lets the engine read only those three columns' worth of bytes; row storage would have to read all fifty columns for every row, then discard the ones it didn't need.
Compression. Values within a single column tend to be far more similar to each other than a mixed row of different columns is (a status column might have only a handful of distinct values, for instance). That similarity compresses much better, and formats like Parquet and ORC take advantage of it with column-specific encodings, which further reduces the bytes actually read from disk.
Skipping data that can't match a filter. Columnar file formats keep summary statistics (like the minimum and maximum value) for chunks of each column. If a query filters on a date range, the engine can check those statistics and skip entire chunks that fall outside the range without reading them at all, on top of the column-level savings already described.
Worked example
Consider a query that computes total revenue for one product category last month, against a wide events table with fifty columns. In row-oriented storage, computing that aggregate still means reading every column of every row in the relevant time range, most of which the query never uses. In columnar storage, the engine reads only the category and revenue columns (plus whatever it needs to apply the date filter), and if the data is organized so most chunks clearly fall outside last month's date range, it can skip those chunks entirely. The net effect is that a query touching two or three columns out of fifty can end up reading a small fraction of the bytes a row-oriented equivalent would.
Trade-offs and pitfalls
Columnar formats aren't universally better: for a workload that reads or writes entire records at a time, like an online transaction touching every field of a single order, row-oriented storage is the better fit, because columnar formats pay a real cost when you need to reconstruct a whole row from scattered column files. This is exactly why transactional (OLTP) systems still use row-oriented storage even though analytical (OLAP) systems have moved to columnar: the two are optimized for genuinely different access patterns, not one being an outdated version of the other.
For a BI workload that needs to serve both live interactive dashboards and heavier ad-hoc analyst queries, how would you choose among compute engines like Presto/Trino, Spark SQL, Databricks SQL, Snowflake, or BigQuery? Walk through what would actually drive that decision.
Sample Answer
The decision mostly comes down to two questions: does this workload need managed, low-operational-overhead concurrency for live dashboards, or does it need flexibility and control for heavy, less predictable ad hoc analysis? Different compute engines are built to answer those two questions differently.
What actually drives the decision
Concurrency and latency for live dashboards. Serverless or fully managed engines (a cloud warehouse's native engine, for example) are generally built to handle many simultaneous interactive queries with automatic scaling and little manual tuning, which is exactly what a live-dashboard workload needs.
Flexibility for heavy, varied ad hoc work. Open-source, cluster-based engines (Spark SQL or a distributed SQL engine like Presto or Trino) give you more control over how compute is sized and tuned, which pays off for large, irregular analytical jobs, but that control comes with the responsibility to actually tune cluster sizing and configuration yourself.
Cost model fit. A pay-per-query model suits bursty, unpredictable usage well, since you're not paying for idle capacity between spikes. A cluster-based, always-on model suits steady, predictable usage better, since a well-utilized cluster running constantly can be cheaper per query than paying for each one individually.
Integration with your table format. If your data already lives in a particular open table format, some engines have more mature, first-class support for it than others; a mismatch here means extra connector overhead or missing features, which matters more the more your workload depends on that table format's specific capabilities (like time travel or fine-grained schema evolution).
Worked example
A team serving both a set of executive dashboards refreshed throughout the day and a data science team running large, irregular exploratory queries would reasonably split these across two different engines rather than force both onto one: the dashboards onto a managed, serverless-style engine tuned for concurrency and low operational overhead, and the exploratory workload onto a cluster-based engine where the team can size compute up for an occasional large join without that cost or contention affecting the dashboards.
The underlying reason to split rather than pick one for everything is the same reason warehouse compute gets separated by workload type in general: a live dashboard's latency requirement and a data scientist's occasional huge, unpredictable query have fundamentally different resource profiles, and a single engine tuned well for one is rarely tuned well for the other by default.
Trade-offs and pitfalls
The most common mistake is picking a single engine for the whole organization based on whichever workload was loudest at the time (usually the dashboards) and then being surprised when the data science team's ad hoc queries are either painfully slow or expensive on an engine tuned for concurrency rather than flexibility. The opposite mistake, choosing a flexible cluster-based engine for everything to avoid maintaining two systems, usually means dashboards inherit tuning and operational overhead they shouldn't need, and inconsistent latency the business notices.
Your company collects clickstream logs, raw sensor telemetry, and structured sales records, and needs to support both ML model training and business reporting. Explain when you'd reach for a data lake versus a data warehouse in this kind of production ML system, and why.
Sample Answer
For this kind of production ML system, I'd reach for a data lake when the value is in raw, high-volume, or not-yet-modeled data (like clickstream events or sensor telemetry), and for a data warehouse when I need consistent, trustworthy business numbers that multiple teams and models rely on. Most production setups actually use both, at different points in the pipeline.
Where each one fits
Raw clickstream logs and sensor telemetry are exactly the kind of data a lake is built for: high volume, evolving structure, and genuinely useful in their raw form for feature engineering that hasn't been designed yet. Forcing a rigid schema onto this data before you know which features will matter would throw away information a model might need later. So the lake is where this raw signal lands and where a data scientist iterates on feature extraction.
Structured sales records, and any aggregate or feature that multiple models or business reports depend on, benefit from living in a warehouse (or a curated layer within a lakehouse): consistent definitions, enforced schema, and fast, predictable queries. If two different models are both training on 'customer lifetime value,' you want one trustworthy, versioned definition of that feature, not each model computing it slightly differently from raw data on its own.
Worked example
Consider a credit-risk model that needs three kinds of input: raw event traces (how a customer actually used the product), derived features (aggregates like 'average transaction size over the last 90 days'), and aggregated business reports (portfolio-level risk exposure for compliance). The raw traces belong in the lake, kept in full fidelity because a future model version might need a feature nobody has thought of yet. The derived features belong in a curated layer, computed once and reused across model versions and teams, specifically so two different models don't silently disagree about what '90-day average transaction size' means. The aggregated business reports belong in the warehouse, because compliance needs one consistent, auditable number, not a query result that could differ depending on who ran it.
As the model matures and gets retrained regularly, the important shift is from 'training directly off raw lake data every time' to 'training off a stable, versioned feature layer,' precisely so retraining is reproducible and doesn't silently change behavior because someone tweaked an upstream raw-data query.
Trade-offs and pitfalls
The most common mistake is letting every model query raw lake data directly for anything it needs, which works early on but quietly creates a different, slightly inconsistent version of the same feature in every model. The second is over-correcting the other way: forcing every piece of raw signal through a heavyweight curation pipeline before a model can touch it, which can slow down legitimate exploration of genuinely new signal. The right balance is usually raw access for exploration and prototyping, and a curated, shared layer for anything that ships to production or that more than one model depends on.
Explain what it means for a cloud data warehouse to separate compute from storage. What does that separation actually buy a team, and what's one situation where keeping compute and storage tightly coupled would still be preferable?
Sample Answer
Separating compute from storage means the query engines that process data and the system that persists it are two independent components that can each scale on their own, rather than being bundled into one tightly coupled machine. For a cloud warehouse, this buys cost flexibility and concurrency; the real trade-off it introduces is that not every situation benefits from that decoupling.
What the separation actually buys you
Cost flexibility. Storage is billed continuously and is comparatively cheap, since it's just persisted, compressed data sitting in object storage. Compute only needs to run while queries are actually executing, so a team can spin up compute for a big nightly job and shut it down afterward, rather than paying for a fixed, always-on machine sized for peak load.
Concurrency. Because compute is decoupled from storage, you can run multiple independent compute clusters (or virtual warehouses) against the same underlying storage at once. A heavy overnight batch job and a set of interactive business intelligence (BI) users can each get their own compute, reading the same data, without competing for the same CPU and memory the way they would on a single coupled system.
Independent scaling. Storage scales with how much data you keep; compute scales with how much querying you're doing right now. Decoupling them means you're not forced to over-provision one to satisfy the other, for example buying more compute than you need just because your data volume grew.
Worked example
Say a warehouse holds five years of order history (large, cheap-to-store data) but most days only a handful of business intelligence (BI) analysts run moderate queries against the last quarter. With compute and storage separated, storage cost stays roughly proportional to the five years of data (cheap, since it's just sitting there), while compute cost stays proportional to actual query activity, a small, right-sized cluster most days, scaled up temporarily if someone runs a big historical analysis. With a tightly coupled system, you'd effectively have to size one machine for both the full data volume and for the occasional heavy query burst, paying for capacity you rarely use.
The one trade-off worth naming honestly: separating compute and storage generally introduces a network hop between them, since compute isn't reading off locally attached disk anymore. For most analytical workloads that's a fine trade for the flexibility gained. It matters more for a workload with extremely tight, latency-sensitive access patterns, where avoiding that network round trip and keeping compute and storage physically co-located would actually perform better.
Trade-offs and pitfalls
The most common misunderstanding is treating this as a free win with no downside: for genuinely latency-critical, tightly-coupled access patterns, like an embedded system reading and writing to local storage with sub-millisecond expectations, the network overhead of a decoupled architecture is a real cost, not a rounding error. For the vast majority of analytical BI and reporting workloads, though, the concurrency and cost benefits outweigh that overhead by a wide margin, which is exactly why every major cloud warehouse has moved to this model.
Compare an event-sourced fact design (append every state-change event, derive current state by replay or a running aggregation) against a snapshot fact design (periodically materialize the current state) for the same business process. Discuss storage growth, query complexity, correctness under replay, and when each approach is the better fit.
Sample Answer
Direct answer
An event-sourced fact design appends every state-change event and derives current or historical state by replaying or aggregating events; a snapshot fact design periodically materializes the current state directly. Event-sourcing preserves the fullest history and audit trail at the cost of replay complexity; snapshotting is simpler to query but only as granular in time as the snapshot interval, and derived-state correctness depends entirely on getting the replay logic right.
Structured elaboration
- Storage growth: event-sourced designs grow with every state change, however small; snapshot designs grow with the number of entities times the number of snapshot periods, which can be smaller or larger depending on how frequently entities actually change versus how often you snapshot.
- Query complexity: reconstructing "current state" or "state as of date X" from an event-sourced table requires replaying or aggregating all relevant events, which is more complex (and more compute-expensive per query, unless materialized separately) than a direct snapshot lookup.
- Correctness under replay: event-sourcing is only as correct as its replay logic; a subtly wrong aggregation rule silently produces wrong derived state for every downstream consumer, and bugs can be hard to detect since the raw events "look right" individually. A periodic snapshot's correctness is easier to spot-check directly against the source system at any given time.
- When each fits: event-sourcing fits when you need a full audit trail of every change and the ability to answer arbitrary historical "what happened" questions you didn't anticipate in advance (since you still have the raw events). Snapshotting fits when you know in advance which point-in-time states matter (daily, hourly) and want simple, fast queries without replay logic.
Worked example
Tracking an order's status: an event-sourced design stores order_status_event(order_id, status, changed_at), one row per transition (placed, paid, shipped, delivered), and "current status" is derived by taking the latest event per order. A snapshot design instead stores order_status_daily(order_id, date_key, status), one row per order per day, directly queryable without replay, but unable to tell you the exact minute a status changed within a day, only what it was as of each day's snapshot.
Trade-offs and pitfalls
A common middle ground is event-sourcing the raw truth (since it's cheap to append and preserves everything) while ALSO maintaining a derived snapshot or accumulating-snapshot table for the common query patterns, so most queries hit the cheap, simple snapshot while the full event history remains available for the rare cases needing finer-grained replay. Pure event-sourcing without any derived materialization pushes replay cost onto every single query, which rarely holds up under real dashboard load.
Unlock Full Question Bank
Get access to all 22 Data Warehousing and Data Lakes interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.