バージョンごとのドキュメント一覧

REFRESH MATERIALIZED VIEW

REFRESH MATERIALIZED VIEW <refpurpose>replace the contents of a materialized view</refpurpose> — マテリアライズドビューの内容を置換する

概要

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

説明

<title>Description</title>

<command>REFRESH MATERIALIZED VIEW</command> completely replaces the contents of a materialized view. To execute this command you must be the owner of the materialized view. The old contents are discarded. If <literal>WITH DATA</literal> is specified (or defaults) the backing query is executed to provide the new data, and the materialized view is left in a scannable state. If <literal>WITH NO DATA</literal> is specified no new data is generated and the materialized view is left in an unscannable state. REFRESH MATERIALIZED VIEWはマテリアライズドビューの内容を完全に置き換えます。 このコマンドを実行するには、マテリアライズドビューの所有者でなければなりません。 古い内容は破棄されます。 WITH DATAが指定されている場合(またはデフォルトでは)、新しいデータを提供するために裏付け問い合わせが実行され、マテリアライズドビューはスキャン可能状態になります。 WITH NO DATAが指定されている場合、新しいデータは生成されず、マテリアライズドビューはスキャン不可状態になります。

<literal>CONCURRENTLY</literal> and <literal>WITH NO DATA</literal> may not be specified together. CONCURRENTLYWITH NO DATAを同時に指定することはできません。

パラメータ

<title>Parameters</title>
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. そのマテリアライズドビューに対して同時に実行されるSELECTをロックすることなく、マテリアライズドビューをREFRESHします。 このオプションを使わない場合、多くの行に影響を与えるREFRESHはリソースをあまり使わず、早く終わる代わりに、そのマテリアライズドビューから読み込もうとしている他の接続をブロックするかもしれません。 影響を与える行が少ない場合は、このオプションは速いかもしれません。

This option is only allowed if there is at least one <literal>UNIQUE</literal> 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 a <literal>WHERE</literal> clause. このオプションは、マテリアライズドビューに、列名だけを使い、すべての行を含むUNIQUEインデックスが少なくとも1つある場合にのみ使えます。 つまり、それは式のインデックスであったり、WHERE句を含んでいてはいけません。

This option may not be used when the materialized view is not already populated. このオプションは、マテリアライズドビューがスキャン不可状態のときは使うことができません。

Even with this option only one <literal>REFRESH</literal> at a time may run against any one materialized view. このオプションを使う場合でも、1つのマテリアライズドビューに対して同時に実行できるREFRESHは一つだけです。

name

The name (optionally schema-qualified) of the materialized view to refresh. 更新するマテリアライズドビューの名前(スキーマ修飾可)です。

注釈

<title>Notes</title>

If there is an <literal>ORDER BY</literal> clause in the materialized view's defining query, the original contents of the materialized view will be ordered that way; but <command>REFRESH MATERIALIZED VIEW</command> does not guarantee to preserve that ordering. マテリアライズドビューを定義する問い合わせにORDER BY句があれば、マテリアライズドビューの元の内容はその順序で並べられます。ですが、REFRESH MATERIALIZED VIEWは、その順序が保たれることを保証しません。

<title>Examples</title>

This command will replace the contents of the materialized view called <literal>order_summary</literal> using the query from the materialized view's definition, and leave it in a scannable state: 以下のコマンドは、マテリアライズドビューの定義からの問い合わせを用いてorder_summaryというマテリアライズドビューの内容を置き換え、スキャン可能状態とします。

REFRESH MATERIALIZED VIEW order_summary;

This command will free storage associated with the materialized view <literal>annual_statistics_basis</literal> and leave it in an unscannable state: 以下のコマンドはマテリアライズドビューannual_statistics_basisに関連する格納領域を解放し、スキャン不可状態とします。

REFRESH MATERIALIZED VIEW annual_statistics_basis WITH NO DATA;

互換性

<title>Compatibility</title>

<command>REFRESH MATERIALIZED VIEW</command> is a <productname>PostgreSQL</productname> extension. REFRESH MATERIALIZED VIEWPostgreSQLの拡張です。

関連項目

<title>See Also</title> CREATE MATERIALIZED VIEW, ALTER MATERIALIZED VIEW, DROP MATERIALIZED VIEW