Materialized Views
Single Origin can help you manage and analyse your materialized views in a convenient manner.
To register a materialized view,
- Select 'Materialized View' item in the navigation bar.
- Click the 'New Materialized View' button.
- Fill the required fields.
- Click the 'Test' button.
- Go back to refine the materialized view sql if you are not satisfied with the test result.
- Click the 'Register' button.
Format of Materialized View Sql
Currently only sqls in the form of CREATE [or update/replace] [TRANSIENT] TABLE/MATERIALIZE VIEW AS SELECT....
are supported and support for other sql forms will be coming soon.
Limitations on Materialized View Support
Only Column Expressions Are Compared
When comparing column usages, Single Origin now compares the column expression string which means two semantically equal column usages could be seen as different.
For example, assuming there is a table PRODUCT
with a column of type OBJECT named meta
, and meta contains two fields created_at
and updated_at
, the two sqls below should be seen as equal:
/// sql 1
SELECT GET(meta, 'created_at') FROM PRODUCT;
/// sql 2
SELECT OBJECT_DELETE(meta, 'updated_at') FROM PRODUCT;
But now they are seen as different since their column expressions are different.
Apart from selected columns, where clauses will also be impacted by this limitation.
Cross View/Source Table Optimization Is Not Supported Yet
Single Origin allows materialized views to be created from an view, however, optimizations of queries based on source table with materialized views created from an view are not supported.
Following the PRODUCT
example above, if there is a view derived from the PRODUCT
table called PRODUCT_VIEW
and a materialized view is created from PRODUCT_VIEW
, a query scanning the source table PRODUCT
could not be optimized by the materialized view even if they share same column usages.
Updated 4 months ago