Why Wide Is Expensive and Narrow Is Nearly Free
Being precise about why the two categories differ so dramatically in cost is what lets you predict performance instead of memorising rules. A narrow operation reads a partition that is already in memory on an executor, applies a function, and produces output in memory on the same executor. The data never leaves the machine. The cost is just the CPU work of the function, which is usually trivial compared to anything involving disk or network. A wide operation, by contrast, pays three expensive costs stacked on top of each other. First, the sending side writes its sorted buckets to local disk, because the data has to be staged before it can be sent. Disk is far slower than memory. Second, the data travels across the network to the receiving executors, and network bandwidth is a shared, limit
About This Interactive Section
This section is part of the Narrow, Wide, and the Shuffle lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live PostgreSQL database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.