Courseiva

Databricks-DE-Pro Developing Code (Python/SQL) Practice Question

When partitioning a large Delta table, what is the best practice regarding the number of unique values in the partition column?

⚠ Common exam trap

Candidates often assume that more partitions are always better for performance. They fail to realize that high-cardinality columns lead to an excessive number of small files, severely degrading query performance.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Low cardinality is preferred to avoid creating too many files.

Choosing a column with too many unique values (high cardinality) for partitioning leads to the 'small files problem.' Each unique value creates a new directory, resulting in an explosion of small files that degrades performance during reads and writes. Best practices suggest partitioning by columns with low to medium cardinality (e.g., date, region) to ensure balanced file sizes and efficient data skipping during query execution.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    High cardinality is preferred for faster data skipping.

    Why it's wrong here

    High cardinality columns result in too many partitions, each potentially containing very small files. This increases the metadata overhead and makes the file listing process slow, which outweighs any benefits from data skipping. Efficient partitioning requires finding a balance between granularity and file size.

  • ✓

    Low cardinality is preferred to avoid creating too many files.

    Why this is correct

    Low cardinality columns ensure that data is grouped into a reasonable number of directories. This prevents the generation of excessive small files, maintaining optimal read performance and reducing the overhead on the file system and the Spark planner during query planning and execution.

  • ✗

    Partitioning should always be done on a primary key column.

    Why it's wrong here

    Primary keys typically have high cardinality, which is the exact opposite of what is recommended for partitioning. Partitioning on a primary key would create one folder per record, making the table unusable due to severe performance degradation and excessive file system operations.

  • ✗

    The number of unique values does not impact performance.

    Why it's wrong here

    The number of unique values in a partition column is a critical performance factor in Spark. Each unique partition value leads to a separate sub-directory on storage. Too many sub-directories will overwhelm the Spark driver, leading to long planning times and poor query performance.

About these practice questions

This Databricks-DE-Pro question is part of Courseiva's 267-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-DE-Pro practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-DE-Pro exam.