云数据库 GaussDB-REFRESH INCREMENTAL MATERIALIZED VIEW:示例

时间:2025-01-26 10:43:42

示例

--创建一个普通表。gaussdb=# CREATE TABLE my_table (c1 int, c2 int)WITH(STORAGE_TYPE=ASTORE);--创建增量物化视图。gaussdb=# CREATE INCREMENTAL MATERIALIZED VIEW my_imv AS SELECT * FROM my_table;--基表写入数据。gaussdb=# INSERT INTO my_table VALUES(1,1),(2,2);--对增量物化视图my_imv进行增量刷新。gaussdb=# REFRESH INCREMENTAL MATERIALIZED VIEW my_imv;--查看增量物化视图。gaussdb=# SELECT * FROM my_imv; c1 | c2 ----+----  1 |  1  2 |  2(2 rows)--删除增量物化视图。gaussdb=# DROP MATERIALIZED VIEW my_imv;--删除表my_table。gaussdb=# DROP TABLE my_table;
support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-0668.html