aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-11-29 12:13:13 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-11-29 12:13:13 -0500
commit2f908e1a3b9c07e43d3ad9ebe6633fae1ed355e3 (patch)
tree913c72cf0398b2de5f974cdbc0115b5677dddf4c
parent733f2be094aabf5468a40e5e0137a1d3a071d81f (diff)
downloadpostgresql-2f908e1a3b9c07e43d3ad9ebe6633fae1ed355e3.tar.gz
postgresql-2f908e1a3b9c07e43d3ad9ebe6633fae1ed355e3.zip
Doc: improve documentation about ORDER BY in matviews.
Remove the confusing use of ORDER BY in an example materialized view. It adds nothing to the example, but might encourage people to follow bad practice. Clarify REFRESH MATERIALIZED VIEW's note about whether view ordering is retained (it isn't). Maciek Sakrejda Discussion: https://postgr.es/m/CAOtHd0D-OvrUU0C=4hX28p4BaSE1XL78BAQ0VcDaLLt8tdUzsg@mail.gmail.com
-rw-r--r--doc/src/sgml/ref/refresh_materialized_view.sgml10
-rw-r--r--doc/src/sgml/rules.sgml3
2 files changed, 4 insertions, 9 deletions
diff --git a/doc/src/sgml/ref/refresh_materialized_view.sgml b/doc/src/sgml/ref/refresh_materialized_view.sgml
index 8ae62671ada..675d6090f3c 100644
--- a/doc/src/sgml/ref/refresh_materialized_view.sgml
+++ b/doc/src/sgml/ref/refresh_materialized_view.sgml
@@ -93,12 +93,10 @@ REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] <replaceable class="parameter">name</
<title>Notes</title>
<para>
- While the default index for future
- <xref linkend="sql-cluster"/>
- operations is retained, <command>REFRESH MATERIALIZED VIEW</command> does not
- order the generated rows based on this property. If you want the data
- to be ordered upon generation, you must use an <literal>ORDER BY</literal>
- clause in the backing query.
+ 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.
</para>
</refsect1>
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index f9df9de8ae1..5b4fc5b12be 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -957,9 +957,6 @@ CREATE MATERIALIZED VIEW sales_summary AS
WHERE invoice_date &lt; CURRENT_DATE
GROUP BY
seller_no,
- invoice_date
- ORDER BY
- seller_no,
invoice_date;
CREATE UNIQUE INDEX sales_summary_seller