Partitions: The Unit of Parallelism

Your data does not arrive at an executor as one big table. The very first thing Spark does with a dataset is cut it into chunks called partitions. A partition is a contiguous slice of the rows, typically targeted around 128 megabytes, that lives in memory on one executor. A billion-row table might become eight thousand partitions scattered across the cluster. This split is the single most important idea in all of Spark, because it is the unit of parallelism: one task processes exactly one partition, and nothing smaller. If you remember one sentence from this entire lesson, make it that one. Almost every tuning decision you will ever make is really a decision about how many partitions exist and how big each one is. Because tasks map one-to-one onto partitions, the partition count is a hard

About This Interactive Section

This section is part of the How a Spark Job Runs 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.