aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorKevin Grittner <kgrittn@postgresql.org>2013-07-16 12:55:44 -0500
committerKevin Grittner <kgrittn@postgresql.org>2013-07-16 12:55:44 -0500
commitcc1965a99bf87005f431804bbda0f723887a04d6 (patch)
tree694801e2e7a34a1247ad7858b9c81ff16a90ac39 /doc/src
parent7f7485a0cde92aa4ba235a1ffe4dda0ca0b6cc9a (diff)
downloadpostgresql-cc1965a99bf87005f431804bbda0f723887a04d6.tar.gz
postgresql-cc1965a99bf87005f431804bbda0f723887a04d6.zip
Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.
This allows reads to continue without any blocking while a REFRESH runs. The new data appears atomically as part of transaction commit. Review questioned the Assert that a matview was not a system relation. This will be addressed separately. Reviewed by Hitoshi Harada, Robert Haas, Andres Freund. Merged after review with security patch f3ab5d4.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/mvcc.sgml3
-rw-r--r--doc/src/sgml/ref/refresh_materialized_view.sgml34
2 files changed, 34 insertions, 3 deletions
diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml
index 316add70b70..cefd3235a6b 100644
--- a/doc/src/sgml/mvcc.sgml
+++ b/doc/src/sgml/mvcc.sgml
@@ -928,8 +928,7 @@ ERROR: could not serialize access due to read/write dependencies among transact
</para>
<para>
- This lock mode is not automatically acquired on tables by any
- <productname>PostgreSQL</productname> command.
+ Acquired by <command>REFRESH MATERIALIZED VIEW CONCURRENTLY</command>.
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/refresh_materialized_view.sgml b/doc/src/sgml/ref/refresh_materialized_view.sgml
index 8f59bbf1231..d2f8104aa7d 100644
--- a/doc/src/sgml/ref/refresh_materialized_view.sgml
+++ b/doc/src/sgml/ref/refresh_materialized_view.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-REFRESH MATERIALIZED VIEW <replaceable class="PARAMETER">name</replaceable>
+REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] <replaceable class="PARAMETER">name</replaceable>
[ WITH [ NO ] DATA ]
</synopsis>
</refsynopsisdiv>
@@ -38,6 +38,10 @@ REFRESH MATERIALIZED VIEW <replaceable class="PARAMETER">name</replaceable>
data is generated and the materialized view is left in an unscannable
state.
</para>
+ <para>
+ <literal>CONCURRENTLY</literal> and <literal>WITH NO DATA</literal> may not
+ be specified together.
+ </para>
</refsect1>
<refsect1>
@@ -45,6 +49,34 @@ REFRESH MATERIALIZED VIEW <replaceable class="PARAMETER">name</replaceable>
<variablelist>
<varlistentry>
+ <term><literal>CONCURRENTLY</literal></term>
+ <listitem>
+ <para>
+ 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.
+ </para>
+ <para>
+ 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 index on any
+ expressions nor include a <literal>WHERE</literal> clause.
+ </para>
+ <para>
+ This option may not be used when the materialized view is not already
+ populated.
+ </para>
+ <para>
+ Even with this option only one <literal>REFRESH</literal> at a time may
+ run against any one materialized view.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>