summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7
parentInitial commit. (diff)
downloadpostgresql-13-upstream.tar.xz
postgresql-13-upstream.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7')
-rw-r--r--doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7119
1 files changed, 119 insertions, 0 deletions
diff --git a/doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7 b/doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7
new file mode 100644
index 0000000..8ed716e
--- /dev/null
+++ b/doc/src/sgml/man7/REFRESH_MATERIALIZED_VIEW.7
@@ -0,0 +1,119 @@
+'\" t
+.\" Title: REFRESH MATERIALIZED VIEW
+.\" Author: The PostgreSQL Global Development Group
+.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
+.\" Date: 2021
+.\" Manual: PostgreSQL 13.4 Documentation
+.\" Source: PostgreSQL 13.4
+.\" Language: English
+.\"
+.TH "REFRESH MATERIALIZED VIEW" "7" "2021" "PostgreSQL 13.4" "PostgreSQL 13.4 Documentation"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+REFRESH_MATERIALIZED_VIEW \- replace the contents of a materialized view
+.SH "SYNOPSIS"
+.sp
+.nf
+REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] \fIname\fR
+ [ WITH [ NO ] DATA ]
+.fi
+.SH "DESCRIPTION"
+.PP
+\fBREFRESH MATERIALIZED VIEW\fR
+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
+WITH 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\&. If
+WITH NO DATA
+is specified no new data is generated and the materialized view is left in an unscannable state\&.
+.PP
+CONCURRENTLY
+and
+WITH NO DATA
+may not be specified together\&.
+.SH "PARAMETERS"
+.PP
+CONCURRENTLY
+.RS 4
+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\&.
+.sp
+This option is only allowed if there is at least one
+UNIQUE
+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
+WHERE
+clause\&.
+.sp
+This option may not be used when the materialized view is not already populated\&.
+.sp
+Even with this option only one
+REFRESH
+at a time may run against any one materialized view\&.
+.RE
+.PP
+\fIname\fR
+.RS 4
+The name (optionally schema\-qualified) of the materialized view to refresh\&.
+.RE
+.SH "NOTES"
+.PP
+While the default index for future
+\fBCLUSTER\fR(7)
+operations is retained,
+\fBREFRESH MATERIALIZED VIEW\fR
+does not order the generated rows based on this property\&. If you want the data to be ordered upon generation, you must use an
+ORDER BY
+clause in the backing query\&.
+.SH "EXAMPLES"
+.PP
+This command will replace the contents of the materialized view called
+order_summary
+using the query from the materialized view\*(Aqs definition, and leave it in a scannable state:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+REFRESH MATERIALIZED VIEW order_summary;
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+This command will free storage associated with the materialized view
+annual_statistics_basis
+and leave it in an unscannable state:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+REFRESH MATERIALIZED VIEW annual_statistics_basis WITH NO DATA;
+.fi
+.if n \{\
+.RE
+.\}
+.SH "COMPATIBILITY"
+.PP
+\fBREFRESH MATERIALIZED VIEW\fR
+is a
+PostgreSQL
+extension\&.
+.SH "SEE ALSO"
+CREATE MATERIALIZED VIEW (\fBCREATE_MATERIALIZED_VIEW\fR(7)), ALTER MATERIALIZED VIEW (\fBALTER_MATERIALIZED_VIEW\fR(7)), DROP MATERIALIZED VIEW (\fBDROP_MATERIALIZED_VIEW\fR(7))