CACHE (Delta Lake on Databricks)

Caches the data accessed by the specified simple SELECT query in the Delta cache. You can choose a subset of columns to be cached by providing a list of column names and choose a subset of rows by providing a predicate. This enables subsequent queries to avoid scanning the original files as much as possible. This construct is applicable only to Parquet tables. Views are also supported, but the expanded queries are restricted to the simple queries, as described above.


CACHE SELECT column_name[, column_name, ...] FROM table_identifier [ WHERE boolean_expression ]

See Delta and Apache Spark caching for the differences between the RDD cache and the Databricks IO cache.

  • table_identifier
    • [database_name.] table_name: A table name, optionally qualified with a database name.
    • delta.`<path-to-table>` : The location of an existing Delta table.


CACHE SELECT width, length FROM boxes WHERE height=3