InterviewStack.io LogoInterviewStack.io

Distributed SQL and Query Scaling Questions

Principles and practices for running and optimizing SQL queries in distributed query engines and cloud data warehouses. Candidates should understand how distributed execution affects query performance including partitioning strategies, shuffle operations, data skew, partition pruning, and cost based optimization in engines such as Spark SQL, Presto, and BigQuery. This topic includes designing queries to minimize data movement, choosing appropriate partition keys, leveraging cluster resources efficiently, and interpreting execution plans and job stages to diagnose bottlenecks in large scale queries.

MediumTechnical
80 practiced
A Trino (Presto) query shows 'Network' stages dominating runtime and EXPLAIN ANALYZE reports large bytes transferred between workers. Describe step-by-step how you'd reduce network shuffle and optimize the plan, including SQL rewrites, use of broadcast, pre-aggregation, and relevant session/engine settings to inspect or change.
MediumSystem Design
64 practiced
You're responsible for a shared analytics cluster used by interactive dashboards and nightly ETL. Describe how you would size and configure the cluster, allocate resources, and implement queuing or isolation to meet low-latency dashboard SLOs while keeping ETL reliable and cost-effective.
EasyTechnical
76 practiced
Given the table schema below (BigQuery standard SQL), write a query that computes daily active users for 2024-04-01 and explain why the query will use partition pruning. Also list two pitfalls that would prevent pruning.
CREATE TABLE dataset.events (
  event_id STRING,
  user_id INT64,
  event_time TIMESTAMP,
  event_date DATE,
  event_type STRING
) PARTITION BY event_date;
Write the SQL and rationale.
EasyTechnical
67 practiced
Describe the difference between materialized views, result caching (BI tool cache), and report snapshots. For a high-traffic executive dashboard that shows hourly aggregates across many filters, recommend an approach balancing freshness, cost, and latency; include pros/cons for each option.
MediumTechnical
77 practiced
For a product analytics workload that needs sub-second aggregations for many ad-hoc filters, explain when to use a star-schema (fact + dimensions) versus denormalized wide tables. Discuss consequences for join complexity, query latency, storage costs, ETL complexity, and how materialized aggregates fit into either approach.

Unlock Full Question Bank

Get access to hundreds of Distributed SQL and Query Scaling interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.