刷新物化视图

用于更新物化视图的SQL命令

REFRESH MATERIALIZED VIEW 是用于更新物化视图的DDL命令。

REFRESH MATERIALIZED VIEW 添加于 PostgreSQL 9.3

更改历史

示例

REFRESH MATERIALIZED VIEW 的基本用法示例

postgres=# CREATE TABLE foo (id INT, val TEXT);
CREATE TABLE

postgres=# INSERT INTO foo VALUES(1, 'bar');
INSERT 0 1

postgres=# CREATE MATERIALIZED VIEW bar AS SELECT * FROM foo;
SELECT 1

postgres=# INSERT INTO foo VALUES(2, 'baz');
INSERT 0 1

postgres=# SELECT * FROM bar;
 id | val 
----+-----
  1 | bar
(1 row)

postgres=# REFRESH MATERIALIZED VIEW bar;
REFRESH MATERIALIZED VIEW

postgres=# SELECT * FROM bar;
 id | val 
----+-----
  1 | bar
  2 | baz
(2 rows)

分类

DDLSQL命令

另请参阅

创建物化视图删除物化视图

反馈

提交任何关于"REFRESH MATERIALIZED VIEW"的评论、建议或更正 此处