After a materialized view is created for an SQL statement, the SQL statement is rewritten to be queried through the materialized view when the SQL statement is executed. If the rewrite cache function is enabled for materialized views, the rewritten SQL statements will be saved to the cache (a maximum of 10,000 records can be saved by default) after the SQL statement is executed for multiple times. When the SQL statement is executed within the cache validity period (24 hours by default), the system obtains the rewritten SQL statement from the cache instead of rewriting the SQL statement.
You can add user-defined parameters rewrite.cache.timeout and rewrite.cache.limit to a compute instance to set the cache validity period and the maximum number of rewritten SQL statements that can be saved.
Run the set session rewrite_cache_enabled=true command on the HetuEngine client by referring to Using the HetuEngine Client.
Parameter |
Value |
Parameter File |
Description |
---|---|---|---|
rewrite.cache.enabled |
true |
coordinator.config.properties |
Enable the rewrite cache function for materialized views. |
rewrite.cache.timeout |
86400000 |
coordinator.config.properties |
|
rewrite.cache.limit |
10000 |
coordinator.config.properties |
|