CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 5 · Lesson 29/45

    Disk cache (formerly Delta cache) for repeated reads

    Understand how caching (Delta cache) improves query performance for repeated reads of the same data.

    16 min read
    2.5% of exam
    5 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Explain how the disk cache speeds up repeated reads of Parquet and Delta Lake files by keeping local SSD copies on worker nodes
    • Describe how the disk cache stays consistent after writes, and when its contents are evicted or lost
    • Pick compute that has the disk cache enabled, and read or change its configuration
    • Tell the disk cache apart from Spark cache()/persist and CACHE TABLE, and say when each one helps or hurts

    Key concept

    Disk cache — A Databricks feature, not part of the Delta Lake protocol. When a worker reads a remote Parquet file, including a file that backs a Delta table, it automatically keeps a copy on its own local storage. Later reads of that file on the same node come from local disk instead of cloud object storage.

    1.How the disk cache turns remote reads into local reads

    Reading a file from cloud object storage takes longer than reading it from a local disk. Without a cache, every query that touches the same Parquet files fetches them from S3 or ABFS again. A validation query followed by an aggregation over the same table pays for the remote fetch twice. Notebooks that run the same exploratory query ten times pay for it ten times.

    The disk cache removes the repeated fetch. When a worker node pulls a Parquet data file from remote storage, it writes a copy to its own local storage in a fast intermediate format. If a later read on that node needs the same file, it reads the local copy, which is much faster. Nobody has to request this. The first read fills the cache, and that read is the only one that pays the remote cost. The cache works for all Parquet data files, and Delta Lake tables store their data as Parquet, so Delta reads benefit without any extra setup.

    The cache holds file data, not answers. It stores copies of the remote files a query reads, so a different query over the same files also gets the speedup. It cannot store the results of arbitrary subqueries, and it never stands in for a query result. Returning a previous answer to a repeated statement is the job of a separate result cache in Databricks SQL. That cache stores query results and is invalidated when the underlying tables change.

    The cache had two earlier names: the Delta cache and the DBIO cache. The name "Delta cache" led people to think the feature was part of the Delta Lake protocol, and Databricks renamed it to correct that. Disk caching is proprietary Databricks behaviour. Nothing about it is written into a table's transaction log, and an engine reading the same Delta table outside Databricks gets no benefit from it. Every node keeps its own cache on its own disks. A file cached on one cluster cannot be read by another cluster.

    Checkpoint 1 of 7· Check yourself

    On a Databricks cluster, a job runs a validation query against a Delta table and then an aggregation over the same Parquet files. An engine outside Databricks also reads that table from cloud storage. What does the disk cache do in this case?

    Checkpoint 2 of 7· Exam question

    Which statement most accurately describes the disk cache feature on Databricks, formerly branded as the Delta cache?

    Sources123

    2.Staying consistent after writes, and losing the cache

    The disk cache never serves stale data, and you do not have to invalidate it. It detects when data files are created, deleted, modified or overwritten, and it updates its contents to match. When a MERGE rewrites files, the old copies become stale entries, and the cache invalidates and evicts them on its own. You can run writes and reads against the same table on the same cluster without any cache management code.

    Entries leave the cache in three ways. The least recently used files are evicted when space runs out. Any change to a file evicts that file's entry. A cluster restart clears everything. SQL warehouses work the same way: the disk cache has the same lifecycle as the local result cache. A warehouse that is stopped or restarted starts with an empty cache, and queries have to fill it again.

    This lifecycle explains why the first query on a fresh cluster is always slower than the ones after it. Two settings should be tested separately. A cold run reads from remote storage. A warm run reads from local copies. If the cold run is the one that matters, for example a job that starts right after a cluster restart, you can prewarm the cache. Run specific queries over the hot tables first, so the data is local before the real workload starts.

    The flag works like a switch on the read path. It does not delete anything. With the cache disabled, queries neither read from it nor add to it, and the files already written stay on local storage.

    Checkpoint 3 of 7· Match them up

    Match each event on a cluster using the disk cache to what happens to the cached data

    Tap a term, then the definition that fits it.

    Sources132

    3.Which compute has the disk cache, and how to configure it

    Whether a cluster uses the disk cache depends on its worker type. Databricks turns the cache on automatically for worker instance types that support it, so most of the configuration is done by choosing the node type. The recommended and simplest option is a worker type with SSD volumes. These cache-accelerated instances come with the cache enabled and tuned. On a node type that does not support disk caching, a repeated read gets no speedup: the second read goes back to cloud storage exactly like the first. A job that sometimes runs on such a node type is fast on some runs and slow on others.

    On a supported worker, the cache uses at most half of the space on the local SSDs. You can change how much local storage it uses with Spark configuration set when you create the cluster. maxDiskUsage is the disk space per node reserved for cached data, in bytes. maxMetaDataCache is the disk space per node reserved for cached metadata. compression.enabled controls whether cached data is stored compressed.

    Example cluster Spark configuration that sizes the disk cachetext
    spark.databricks.io.cache.maxDiskUsage 50g
    spark.databricks.io.cache.maxMetaDataCache 1g
    spark.databricks.io.cache.compression.enabled false

    You can check the current state from a notebook. The same key passed to spark.conf.set with true or false turns the cache on or off for the session.

    Checking whether the disk cache is enabledpython
    spark.conf.get("spark.databricks.io.cache.enabled")

    Older code may use CACHE SELECT to load chosen columns or rows into the disk cache ahead of time. On SQL warehouses and on Databricks Runtime 14.2 and above, that command is ignored and an enhanced caching algorithm decides what to cache. The command does nothing, but it does not fail. The cache also helps with diagnosis. If a slow stage in the Spark UI shows a large Input column because it reads the same data several times, the disk cache is one of the listed fixes. The other read fixes include better data skipping and Photon. For more on reading stage I/O, see debugging with the Spark UI.

    Checkpoint 4 of 7· Check yourself

    A team's iterative notebook queries re-read the same Delta tables, but every repeated read is as slow as the first. Which change does Databricks recommend so that the repeated reads come from local storage?

    Checkpoint 5 of 7· Exam question

    A nightly job reads the same partition of a Delta table twice: once for a validation query and once, minutes later, for the main aggregation. The engineer expects the second read to be noticeably faster than the first because of the disk cache, but on some runs it is not. Which factor most likely explains the inconsistent speedup?

    Sources14

    4.Disk cache versus Spark cache() and persist

    Spark has its own caching API, and the two mechanisms are easy to mix up. They work at different levels. The disk cache copies raw Parquet file bytes, automatically, for any query that reads those files. df.cache(), df.persist(...) and CACHE TABLE keep the computed result of one DataFrame or query, stored as blocks whose location depends on the storage level. Spark caching only happens when code asks for it. Both are lazy: nothing is cached until data is actually read.

    Disk cache compared with the Apache Spark cache
    FeatureDisk cacheApache Spark cache
    Stored asLocal files on a worker nodeIn-memory blocks, depending on storage level
    Applied toAny Parquet table stored on S3, ABFS and other file systemsAny DataFrame or RDD
    TriggeredAutomatically, on the first read (if the cache is enabled)Manually, requires code changes
    EvaluatedLazilyLazily
    AvailabilityEnabled by default on certain node types; configuration flags turn it on or offAlways available
    EvictedLRU, on any file change, or when the cluster restartsLRU, or manually with unpersist

    Spark caching can do some things the disk cache cannot. It can hold the output of any subquery, such as a costly join you plan to reuse three times. It can also hold data from formats other than Parquet, such as CSV, JSON and ORC. CACHE TABLE accepts a storage level such as DISK_ONLY or MEMORY_ONLY, and it uses MEMORY_AND_DISK when you do not set one. The cached data is shared across all Spark sessions on the cluster.

    CACHE TABLE caching a query result with an explicit storage levelsql
    > CACHE TABLE testCache OPTIONS ('storageLevel' 'DISK_ONLY') SELECT * FROM testData;

    Spark caching also costs more than people expect. Cached blocks are held in memory, depending on the storage level, until they are evicted in LRU order or released with unpersist, so every cached result takes memory away from the queries that run alongside it. If the cache call sits in the wrong place in a query, it can fill all available memory and make queries much slower. On an autoscaling cluster, when a worker is decommissioned, the Spark cache on that worker is lost, and Spark has to reread the missing partitions from the source. CACHE TABLE is not compatible with the serverless compute architecture, where caching is tuned automatically. If you really need a result to persist, write it to a Delta table. As a general rule, Databricks recommends avoiding Spark caching, and using the disk cache for repeated reads of Parquet and Delta Lake data.

    For a DataFrame built from a Delta table, then, calling df.cache() does not repeat what the disk cache already does. It is a separate, manual copy of one computed result, held in memory or on disk depending on the storage level, and released with unpersist. The disk cache, by contrast, already speeds up reads of the underlying files with no code at all. Spark caching only pays off when the expensive step is the computation rather than the file read, or when the source is not Parquet.

    Checkpoint 6 of 7· Fill the gap

    This statement keeps the computed result of a query in the Apache Spark cache rather than in the disk cache, and sets the storage level explicitly. Which keyword completes it?

    > CACHE  ?  testCache OPTIONS ('storageLevel' 'DISK_ONLY') SELECT * FROM testData;

    Checkpoint 7 of 7· Exam question

    A data engineer notices that several notebooks call df.cache() (or df.persist(StorageLevel.MEMORY_AND_DISK)) on a DataFrame built from a Delta table, expecting this to behave the same way as the cluster's disk cache. During code review, which statement correctly distinguishes the two mechanisms?

    Sources125

    Sources

    (5)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “it automatically stores a copy on its local storage in a fast intermediate format”
      ↩︎ How the disk cache turns remote reads into local reads
      “The cache works for all Parquet data files, including Delta Lake tables.”
      ↩︎ How the disk cache turns remote reads into local reads
      “Disk caching on Databricks was formerly referred to as the Delta cache and the DBIO cache.”
      ↩︎ How the disk cache turns remote reads into local reads
      “Any stale entries are automatically invalidated and evicted from the cache.”
      ↩︎ Staying consistent after writes, and losing the cache
      “Automatically in LRU fashion or on any file change, manually when restarting a cluster.”
      ↩︎ Staying consistent after writes, and losing the cache
      “Instead, it prevents queries from adding new data to the cache and reading data from the cache.”
      ↩︎ Staying consistent after writes, and losing the cache
      “The recommended (and easiest) way to use disk caching is to choose a worker type with SSD volumes when you configure your cluster.”
      ↩︎ Which compute has the disk cache, and how to configure it
      “The disk cache is configured to use at most half of the space available on the local SSDs provided with the worker nodes.”
      ↩︎ Which compute has the disk cache, and how to configure it
      “In SQL warehouses and Databricks Runtime 14.2 and above, the CACHE SELECT command is ignored.”
      ↩︎ Which compute has the disk cache, and how to configure it
      “In-memory blocks, but it depends on storage level.”
      ↩︎ Disk cache versus Spark cache() and persist
      “When a worker is decommissioned, the Spark cache stored on that worker is lost.”
      ↩︎ Disk cache versus Spark cache() and persist
      “it automatically stores a copy on its local storage in a fast intermediate format”
      ↩︎ Key concept
      “This name change seeks to resolve confusion that it was part of the Delta Lake protocol.”
      ↩︎ Exam trap 1
      “You can write, modify, and delete table data with no need to explicitly invalidate cached data.”
      ↩︎ Exam trap 2
      “Use the disk cache instead of the Apache Spark cache for repeated reads of Parquet and Delta Lake data.”
      ↩︎ Exam trap 3
      “Databricks enables it automatically on worker instance types that support it.”
      ↩︎ Exam trap 4
      “Disk caching behavior is a proprietary Databricks feature. This name change seeks to resolve confusion that it was part of the Delta Lake protocol.”
      ↩︎ Checkpoint
      “Disabling the cache does not result in dropping the data that is already in the local storage.”
      ↩︎ Prediction
    2. 2.
      “It can improve the performance for a wide range of queries but cannot be used to store the results of arbitrary subqueries.”
      ↩︎ How the disk cache turns remote reads into local reads
      “Caches can be prewarmed by running specific queries to initialize caches (for example, after a cluster restart).”
      ↩︎ Staying consistent after writes, and losing the cache
      “can store the result of any subquery data and data stored in formats other than Parquet (such as CSV, JSON, and ORC)”
      ↩︎ Disk cache versus Spark cache() and persist
      “However, using incorrect locations in a query can consume all available memory and significantly slow down queries.”
      ↩︎ Disk cache versus Spark cache() and persist
    3. 3.
      “Both caches are invalidated when the underlying tables are updated.”
      ↩︎ How the disk cache turns remote reads into local reads
      “The disk cache shares the same lifecycle characteristics as the local result cache.”
      ↩︎ Staying consistent after writes, and losing the cache
    4. 5.
      “Databricks recommends against using CACHE TABLE as it is not compatible with Databricks serverless compute architecture.”
      ↩︎ Disk cache versus Spark cache() and persist
      “If storageLevel is not explicitly set using OPTIONS clause, the default storageLevel is set to MEMORY_AND_DISK.”
      ↩︎ Disk cache versus Spark cache() and persist

    Spotted a mistake, or was something unclear? Tell us.