CACHE (Delta Lake on Azure Databricks)CACHE (Delta Lake on Azure Databricks)
指定した単純なクエリによってアクセスされるデータを SELECT
デルタキャッシュにキャッシュします。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. このコンストラクトは、Parquet テーブルにのみ適用できます。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.
SyntaxSyntax
CACHE SELECT column_name[, column_name, ...] FROM table_identifier [ WHERE boolean_expression ]
RDD キャッシュと Databricks IO キャッシュの違いについては、「 デルタと Apache Spark のキャッシュ 」を参照してください。See Delta and Apache Spark caching for the differences between the RDD cache and the Databricks IO cache.
- table_identifiertable_identifier
[database_name.] table_name
: テーブル名。必要に応じて、データベース名で修飾します。[database_name.] table_name
: A table name, optionally qualified with a database name.delta.`<path-to-table>`
: 既存のデルタテーブルの場所。delta.`<path-to-table>`
: The location of an existing Delta table.
使用例Examples
CACHE SELECT * FROM boxes
CACHE SELECT width, length FROM boxes WHERE height=3