ALTER MATERIALIZED VIEW
功能描述
修改物化视图属性。
注意事项
无
语法格式
ALTER MATERIALIZED VIEW [ IF EXISTS ] { materialized_view_name } [ ENABLE | DISABLE ] QUERY REWRITE; ALTER MATERIALIZED VIEW [ IF EXISTS ] { materialized_view_name } REFRESH [ [ COMPLETE ] [ ON DEMAND ] [ [ START WITH (timestamptz) ] | [ EVERY (interval) ] ]; ALTER MATERIALIZED VIEW { materialized_view_name } OWNER TO new_owner; ALTER MATERIALIZED VIEW { materialized_view_name } SET ( {storage_parameter = value} [, ... ] ) | RESET ( storage_parameter [, ... ] )
参数说明
- ENABLE | DISABLE QUERY REWRITE
是否对本物化视图启动查询重写。
在启用物化视图的查询重写后需刷新物化视图,保证物化视图数据是最新的。
- REFRESH [ COMPLETE ] [ ON DEMAND ] [ [ START WITH (timestamptz) ] | [EVERY (interval)] ]
修改物化视图的刷新方式。
- SET ( {storage_parameter = value} [, ... ] ) | RESET ( storage_parameter [, ... ] )
支持设置物化视图的表属性。该语法仅9.1.0.200及以上集群版本支持。
支持设置参数:mv_pck_column,bitmap_columns,enable_foreign_table_query_rewrite,excluded_inactive_tables,force_rewrite_timeout,mv_analyze_mode等,具体可参考参数说明。
- OWNER TO new_owner
修改物化视图的owner。
示例
启用物化视图的查询重写。
ALTER MATERIALIZED VIEW mv1 ENABLE QUERY REWRITE; NOTICE: REFRESH MATERIALIZED VIEW should be executed to enable query rewrite. ALTER MATERIALIZED VIEW
修改物化视图的表属性。
1 2 3 |
ALTER MATERIALIZED VIEW mv1 SET (force_rewrite_timeout=100); ALTER MATERIALIZED VIEW mv1 SET ( mv_pck_column='col1'); ALTER MATERIALIZED VIEW mv1 SET (enable_foreign_table_query_rewrite = true); |