Analytical Query Performance and Optimization Questions

Diagnosing and tuning analytical queries on distributed and warehouse engines. Covers reading and reasoning about query plans, join strategy and ordering including broadcast versus shuffle, statistics and cardinality estimation, materialized views and result caching, skew and spill diagnosis, workload management and concurrency, and the cost side of query performance on engines billed by bytes scanned or compute time. The altitude is the deep, engine-specific operational layer: what a real plan on a real warehouse engine is telling you and what to change. Generic single-engine query-tuning fundamentals, the physical layout of the data being scanned, and the choice of which managed platform to run on are covered separately.

MediumTechnical
45 practiced

Compare ETL and ELT specifically for a cloud data warehouse: where does transformation happen in each, and how does that choice affect downstream query performance and compute cost (not just pipeline architecture)? Why have modern cloud warehouses pushed many teams toward ELT?

MediumTechnical
59 practiced

Given events(id, user_id, amount, event_time) and a materialized daily_user_totals(date, user_id, total_amount), write SQL (or precise pseudo-SQL) that incrementally updates daily_user_totals for only the dates present in a staging_events table, correctly handling inserts, updates, and deletes idempotently while minimizing locks on the target table.

MediumTechnical
54 practiced

You need to choose between an OLAP-cube pre-aggregation layer and ad-hoc SQL directly on a columnar warehouse for business reporting. List the pros and cons of each, and recommend an approach for a product analytics team that needs metrics refreshed roughly every 5 minutes.

MediumTechnical
54 practiced

You optimize a query so it now scans 200 GB per run instead of 5 TB. If the warehouse charges $5 per TB scanned and the query runs 100 times a day, estimate the daily and annualized savings. State your assumptions and what could make the real savings differ.

MediumTechnical
57 practiced

Explain bucketing (or co-partitioning) in a distributed engine like Hive/Spark/Presto: what it offers beyond partitioning, how it lets two large tables join without a full shuffle when both are bucketed on the join key, and what constraints and ongoing maintenance it requires.

Unlock Full Question Bank

Get access to all 46 Analytical Query Performance and Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.