Data Engineer Professional · Domain 9: Data Modeling · 5% of the exam
Task 9.1: Design scalable Delta/Iceberg table layouts for large data assets by mapping partitioning to data grain, aligning clustering to relationship access patterns, and maintaining balanced file sizes through compaction.
Partition grain and size limits, clustering on join and filter keys, target file sizes, compaction and auto compaction, and managed Iceberg tables.
Study it
Table layouts: partition grain, clustering keys and file sizes
Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.
Question 1 · choose 1
An external Delta fact table, not maintained by predictive optimization, has grown from 2 TB to 12 TB over a year. Reports show that most of its files are still about 256 MB, although new files are near 1 GB. The team wants the whole table compacted to files of about 1 GB. What should the data engineer do?
ARun VACUUM on the table to clear out the smaller files
BSet autoOptimize.autoCompact to true on the table
CCall coalesce(1) before each write to the table
DSet delta.targetFileSize to 1gb, then OPTIMIZE
Show the answer and why
ARun VACUUM on the table to clear out the smaller files
Incorrect
VACUUM removes files no longer referenced by the table; it does not merge the current files.
BSet autoOptimize.autoCompact to true on the table
Incorrect
With true, auto compaction targets 128 MB files and does not rewrite older files.
CCall coalesce(1) before each write to the table
Incorrect
Forcing one output file per write slows writes and does not fix the existing files.
DSet delta.targetFileSize to 1gb, then OPTIMIZE
Correct
When the autotuned target grows, OPTIMIZE does not re-optimize existing files; a fixed target makes it compact them to that size.
Databricks autotunes target file size by table size, from 256 MB for smaller tables up to 1 GB above 10 TB. Existing files are not rewritten when the target grows, so a fixed targetFileSize is needed if all files must reach the larger size.
Queries join an 8 TB fact table to small store and date dimensions and filter only on dimension attributes, such as region. The fact table is unpartitioned, and its scans read nearly every file. The team also runs MERGE statements on the fact table by store_id. Which TWO changes help dynamic file pruning skip fact files? (Choose TWO.)
AUse liquid clustering on the fact table's join keys, such as store_id
BPartition the fact table by store_id
CCluster the small dimension tables by region
DRun the queries and MERGE statements on Photon-enabled compute
EAdd a BROADCAST hint for the dimension tables
Show the answer and why
AUse liquid clustering on the fact table's join keys, such as store_id
Correct
Clustering on the columns used in joins colocates matching rows, so dynamic file pruning can skip more files.
BPartition the fact table by store_id
Incorrect
Partitioning a large table by a high-cardinality key creates many small partitions and is not the recommended layout.
CCluster the small dimension tables by region
Incorrect
Pruning is applied to the scan of the large table, so the fact table's layout is what matters.
DRun the queries and MERGE statements on Photon-enabled compute
Correct
Dynamic file pruning in MERGE requires Photon, and Photon gives broader pruning for SELECT.
EAdd a BROADCAST hint for the dimension tables
Incorrect
Broadcasting changes the join strategy but does not make the fact layout prunable.
Dynamic file pruning pushes join filter results into the scan of the large Delta table at runtime. It works best when the join columns are clustered, and for MERGE, UPDATE and DELETE it requires Photon.
Writes to a very narrow table, with only two small columns, fail because a data file would exceed the Parquet format's row limit. What does Databricks suggest?
ARaise delta.targetFileSize to 10gb on the table
BTurn off optimized writes for the narrow table
CSet maxRecordsPerFile, as a Spark conf or a write option
DPartition the table by both columns to spread the rows
Show the answer and why
ARaise delta.targetFileSize to 10gb on the table
Incorrect
Larger files hold even more rows.
BTurn off optimized writes for the narrow table
Incorrect
That changes file sizing but does not cap rows per file.
CSet maxRecordsPerFile, as a Spark conf or a write option
Correct
Capping records per file avoids the error; Databricks recommends it only when necessary.
DPartition the table by both columns to spread the rows
Incorrect
Partitioning a narrow table creates many tiny partitions.
Narrow tables can hit the Parquet limit on rows per file. Use spark.sql.files.maxRecordsPerFile or the DataFrameWriter option maxRecordsPerFile, which takes precedence, only when needed.
A data engineer wonders which writes to an external Delta table already use optimized writes without any table or session setting. Which operation is one of them?
AA streaming append with a processing-time trigger
BA DataFrame write after coalesce(10)
CCOPY INTO from a classic cluster
DA MERGE INTO statement that upserts changes
Show the answer and why
AA streaming append with a processing-time trigger
Incorrect
Streaming appends are not in the default list.
BA DataFrame write after coalesce(10)
Incorrect
Databricks advises against coalesce or repartition before writes when optimized writes are used.
CCOPY INTO from a classic cluster
Incorrect
COPY INTO is not among the operations listed as enabled by default.
DA MERGE INTO statement that upserts changes
Correct
Optimized writes are enabled by default for MERGE, and for UPDATE and DELETE with subqueries.
Optimized writes shuffle data before writing to produce fewer, larger files. They are on by default for MERGE and for UPDATE and DELETE with subqueries, and for CTAS and INSERT on SQL warehouses.
A legacy notebook that writes to a new Unity Catalog managed table still sets spark.databricks.delta.autoCompact.enabled in its Spark config. What does Databricks recommend?
ARemove the setting so background auto compaction applies
BSet it to legacy to keep the old fixed 128 MB file size
CAdd autoOptimize.optimizeWrite = false to the table's properties
DRun OPTIMIZE on the table after every write instead
Show the answer and why
ARemove the setting so background auto compaction applies
Correct
Background auto compaction is available for managed tables once the old Spark setting is removed.
BSet it to legacy to keep the old fixed 128 MB file size
Incorrect
Fixed legacy sizing works against automatic tuning.
CAdd autoOptimize.optimizeWrite = false to the table's properties
Incorrect
Turning off optimized writes does not enable background compaction.
DRun OPTIMIZE on the table after every write instead
Incorrect
Manual OPTIMIZE after every write adds cost.
Background auto compaction is available for Unity Catalog managed tables and does not need predictive optimization. When migrating, remove the autoCompact Spark configuration from cluster or notebook settings.