云数据库 GAUSSDB-CREATE MATERIALIZED VIEW:示例

时间:2024-11-02 18:53:03

示例

--创建一个普通表
openGauss=# CREATE TABLE my_table (c1 int, c2 int);
--创建全量物化视图
openGauss=# CREATE MATERIALIZED VIEW my_mv AS SELECT * FROM my_table;
--基表写入数据
openGauss=# INSERT INTO my_table VALUES(1,1),(2,2);
--对全量物化视图my_mv进行全量刷新
openGauss=# REFRESH MATERIALIZED VIEW my_mv;
support.huaweicloud.com/centralized-devg-v2-gaussdb/devg_03_0559.html