Skip to content
Gold 6 min read 2 practice problems ↓

Dynamic partition pruning

Skip whole partitions of a fact table at runtime using a filter on the dimension it joins to.

Step 2 · Spark internals · Gold · Layout tricks, lesson 1 of 2

Read first: Broadcast joins · Catalyst and physical plans (skip if you know them)

In plain words first

You want the receipts from Diwali week, but the receipts are filed by date, not by festival. Look up the calendar first, find the dates of Diwali week, and only open those date folders.

That is dynamic partition pruning: Spark first works out which keys pass the dimension filter, then reads only those partitions of the fact table.

Unlock the full lesson

You have read the free part. The rest of this advanced lesson:

  • Static pruning, and its limit
  • How DPP works
  • When it applies
  • Seeing it in a plan
  • In a lakehouse
  • Try it yourself
  • Common mistakes
  • Key takeaways
  • Interview prep with 3 follow-up questions
  • Check yourself: 3 questions

Unlock it with the Complete pass (every advanced problem and lesson) or on its own.

Practise this

Problems that use this, graded on hidden tests

Keep going

Up next · Layout tricks · lesson 2 of 2 · 6 min read
Bucketing
Pre-shuffle tables into buckets so joins and aggregations on the key skip the shuffle.

Related lessons

Previous: Serialization: Java, Kryo, Tungsten and Arrow

Primary sources: Configuration: dynamicPartitionPruning · Performance tuning