1REFRESH MATERIALIZED VIEW(P7o)stgreSQL 12.6 DocumentatRiEoFnRESH MATERIALIZED VIEW(7)
2
3
4

NAME

6       REFRESH_MATERIALIZED_VIEW - replace the contents of a materialized view
7

SYNOPSIS

9       REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] name
10           [ WITH [ NO ] DATA ]
11

DESCRIPTION

13       REFRESH MATERIALIZED VIEW completely replaces the contents of a
14       materialized view. To execute this command you must be the owner of the
15       materialized view. The old contents are discarded. If WITH DATA is
16       specified (or defaults) the backing query is executed to provide the
17       new data, and the materialized view is left in a scannable state. If
18       WITH NO DATA is specified no new data is generated and the materialized
19       view is left in an unscannable state.
20
21       CONCURRENTLY and WITH NO DATA may not be specified together.
22

PARAMETERS

24       CONCURRENTLY
25           Refresh the materialized view without locking out concurrent
26           selects on the materialized view. Without this option a refresh
27           which affects a lot of rows will tend to use fewer resources and
28           complete more quickly, but could block other connections which are
29           trying to read from the materialized view. This option may be
30           faster in cases where a small number of rows are affected.
31
32           This option is only allowed if there is at least one UNIQUE index
33           on the materialized view which uses only column names and includes
34           all rows; that is, it must not be an expression index or include a
35           WHERE clause.
36
37           This option may not be used when the materialized view is not
38           already populated.
39
40           Even with this option only one REFRESH at a time may run against
41           any one materialized view.
42
43       name
44           The name (optionally schema-qualified) of the materialized view to
45           refresh.
46

NOTES

48       While the default index for future CLUSTER(7) operations is retained,
49       REFRESH MATERIALIZED VIEW does not order the generated rows based on
50       this property. If you want the data to be ordered upon generation, you
51       must use an ORDER BY clause in the backing query.
52

EXAMPLES

54       This command will replace the contents of the materialized view called
55       order_summary using the query from the materialized view's definition,
56       and leave it in a scannable state:
57
58           REFRESH MATERIALIZED VIEW order_summary;
59
60       This command will free storage associated with the materialized view
61       annual_statistics_basis and leave it in an unscannable state:
62
63           REFRESH MATERIALIZED VIEW annual_statistics_basis WITH NO DATA;
64

COMPATIBILITY

66       REFRESH MATERIALIZED VIEW is a PostgreSQL extension.
67

SEE ALSO

69       CREATE MATERIALIZED VIEW (CREATE_MATERIALIZED_VIEW(7)), ALTER
70       MATERIALIZED VIEW (ALTER_MATERIALIZED_VIEW(7)), DROP MATERIALIZED VIEW
71       (DROP_MATERIALIZED_VIEW(7))
72
73
74
75PostgreSQL 12.6                      2021         REFRESH MATERIALIZED VIEW(7)
Impressum