Databricks - Data Engineer Professional Study Guide

    6: Cost & Performance Optimisation

    This chapter covers the cost and performance optimisation surface on the Databricks Data Intelligence Platform: how Unity Catalog managed tables shift maintenance work from the engineer to the platform, how deletion vectors and Liquid Clustering reshape the read and write cost curves, how data skipping and file pruning translate physical layout into query latency, how Change Data Feed addresses streaming table limitations, and how the Query Profile UI exposes the bottlenecks that drive every tuning decision.

    Learning Objectives

    By the end of this chapter, you will be able to:

    • Understand how and why using Unity Catalog managed tables reduces operations overhead and maintenance burden.
    • Understand Delta optimization techniques, such as deletion vectors and Liquid Clustering.
    • Understand the optimization techniques used by Databricks to guarantee the performance of queries on large datasets (data skipping, file pruning, and related mechanisms).
    • Apply Change Data Feed (CDF) to address specific limitations of streaming tables and improve latency.
    • Use the Query Profile to analyse queries and identify bottlenecks, such as poor data skipping, inefficient join types, and excessive data shuffling.

    Executive Summary

    • Unity Catalog managed tables let the platform own the storage path, the file layout, and the maintenance schedule, which removes the operational drag of cluster-driven OPTIMIZE, VACUUM, and statistics collection that external tables still impose on the engineer.
    • Deletion vectors decouple DELETE, UPDATE, and MERGE from the cost of rewriting Parquet files by recording row-level tombstones, while Liquid Clustering replaces the partition-versus-Z-ORDER choice with a self-tuning clustering layout that adapts to evolving query patterns.
    • Data skipping uses per-file min and max statistics on the first 32 columns to prune files before they are opened; file pruning combined with predicate pushdown and Photon vectorised reads is what turns a petabyte-scale Delta table into a sub-second scan when the predicates are aligned with the layout.
    • Change Data Feed exposes row-level change events from a Delta table as a streamable source, which is the lever that converts a downstream streaming table from reprocessing the full history on each restart to consuming only the deltas since its last checkpoint.
    • The Query Profile UI is the single canonical evidence surface for SQL warehouse statements, exposing files read versus files pruned, exchange (shuffle) bytes, join strategy per node, and the most expensive operator; every tuning decision in this chapter is justified by a measurement taken from that profile.

    Assumptions

    • The reader has already worked through Chapter 5 and is fluent with the Spark UI tabs, the system.billing.usage and system.query.history tables, the Lakeflow Spark Declarative Pipelines event log, and the four life-cycle states of a Jobs run.
    • Unity Catalog is the only metastore in scope. Hive Metastore behaviour is mentioned only when it differs materially from Unity Catalog, and is never the recommended path.
    • The reader is comfortable with the Bronze, Silver, and Gold layering established in Chapters 1 through 3, including the append-only Bronze ingestion patterns and the Silver quarantine flow.
    • All file-size, retention, and column-statistics defaults cited are taken from the official Databricks documentation set referenced at preflight; when a default is configurable, the override knob and its scope (table property, session conf, or cluster conf) are called out explicitly.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account
    6. Free with account