Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
REFRESH MATERIALIZED VIEW
Prev UpSQL CommandsHome Next

REFRESH MATERIALIZED VIEW

REFRESH MATERIALIZED VIEW — replace the contents of a materialized view

Synopsis

REFRESH MATERIALIZED VIEW [ CONCURRENTLY ]name    [ WITH [ NO ] DATA ]

Description

REFRESH MATERIALIZED VIEW completely replaces the contents of a materialized view. To execute this command you must have theMAINTAIN privilege on the materialized view. The old contents are discarded. IfWITH DATA is specified (or defaults) the backing query is executed to provide the new data, and the materialized view is left in a scannable state. IfWITH NO DATA is specified no new data is generated and the materialized view is left in an unscannable state.

CONCURRENTLY andWITH NO DATA may not be specified together.

Parameters

CONCURRENTLY

Refresh the materialized view without locking out concurrent selects on the materialized view. Without this option a refresh which affects a lot of rows will tend to use fewer resources and complete more quickly, but could block other connections which are trying to read from the materialized view. This option may be faster in cases where a small number of rows are affected.

This option is only allowed if there is at least oneUNIQUE index on the materialized view which uses only column names and includes all rows; that is, it must not be an expression index or include aWHERE clause.

This option can only be used when the materialized view is already populated.

Even with this option only oneREFRESH at a time may run against any one materialized view.

name

The name (optionally schema-qualified) of the materialized view to refresh.

Notes

If there is anORDER BY clause in the materialized view's defining query, the original contents of the materialized view will be ordered that way; butREFRESH MATERIALIZED VIEW does not guarantee to preserve that ordering.

WhileREFRESH MATERIALIZED VIEW is running, thesearch_path is temporarily changed topg_catalog, pg_temp.

Examples

This command will replace the contents of the materialized view calledorder_summary using the query from the materialized view's definition, and leave it in a scannable state:

REFRESH MATERIALIZED VIEW order_summary;

This command will free storage associated with the materialized viewannual_statistics_basis and leave it in an unscannable state:

REFRESH MATERIALIZED VIEW annual_statistics_basis WITH NO DATA;

Compatibility

REFRESH MATERIALIZED VIEW is aPostgres Pro extension.


Prev Up Next
REASSIGN OWNED Home REINDEX
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp