Refresh operations for materialized views
Important
Materialized views in Databricks SQL are in Public Preview.
Materialized views are database objects that contain the results of a SQL query against one or more base tables. Some materialized views can be incrementally refreshed, automatically and incrementally propagating changes from the base tables.
This article explains the types of refresh operations you can apply to materialized views, and identifies the SQL operations, keywords, and clauses that support incremental refresh.
Note
To create and use materialized views, your workspace must meet the requirements.
Refresh types
Refresh operations are one of these types:
- Incremental refresh: An incremental refresh processes changes in the underlying data after the last refresh and then appends that data to the table. Depending on the base tables and included operations, only certain types of materialized views can be incrementally refreshed.
- Full refresh: A full refresh truncates the table and reprocesses all data available in the source with the latest definition. It is not recommended to perform full refreshes on sources that don’t keep the entire data history or have short retention periods, such as Kafka, because the full refresh truncates the existing data. You may be unable to recover old data if the data is no longer available in the source.
Support for materialized view incremental refresh
The following table lists support for incremental refresh by SQL keyword or clause:
SQL keyword or clause | Support for incremental refresh |
---|---|
SELECT expressions |
Expressions including deterministic built-in functions and immutable user-defined functions (UDFs) are supported. |
WITH |
Yes, common table expressions are supported. |
FROM |
Supported base tables include Delta tables, materialized views, and streaming tables |
EXPECTATIONS |
No. Materialized views that use expectations are always fully refreshed. |
UNION ALL |
No |
INNER JOIN |
No |
LEFT JOIN |
No |
GROUP BY |
Yes |
WHERE , HAVING |
Filter clauses such as WHERE and HAVING are supported. |
OVER |
No |
QUALIFY |
No |
Note
Non-deterministic functions, for example, CURRENT_TIMESTAMP
, are not supported.
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om