QuestionQ25

VerifiedCost & Performance Optimisation

Given the following PySpark code in a Databricks notebook:

filtered_df=spark.read.format(“delta”).load(“/mnt/daya/large_table”) \  
.filter (“event_date> ‘2024-01-01’”)  
filtered_df.count ()  

The data engineer sees in the Query Profile that the scan operator for filtered_df reads nearly all files despite the filter being applied.

What is the likely reason for ineffective data skipping?

Explanation

Delta data skipping uses per-file statistics to eliminate files whose value ranges cannot satisfy a predicate. It is most effective when filtered values are colocated through partitioning, Z-ordering, or clustering. If event_date is outside the table’s partitioning and Z-ordering scheme, matching and nonmatching dates may be spread across almost every file, so most file ranges overlap the date predicate and must be read. Databricks data skipping documentation

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!