Skip to content

Commit 4f33af2

Browse files
committed
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
1 parent e04a805 commit 4f33af2

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

doc/src/sgml/ref/refresh_materialized_view.sgml

+4-6
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ REFRESH MATERIALIZED VIEW [ CONCURRENTLY ] <replaceable class="parameter">name</
9393
<title>Notes</title>
9494

9595
<para>
96-
While the default index for future
97-
<link linkend="sql-cluster"><command>CLUSTER</command></link>
98-
operations is retained, <command>REFRESH MATERIALIZED VIEW</command> does not
99-
order the generated rows based on this property. If you want the data
100-
to be ordered upon generation, you must use an <literal>ORDER BY</literal>
101-
clause in the backing query.
96+
If there is an <literal>ORDER BY</literal> clause in the materialized
97+
view's defining query, the original contents of the materialized view
98+
will be ordered that way; but <command>REFRESH MATERIALIZED
99+
VIEW</command> does not guarantee to preserve that ordering.
102100
</para>
103101
</refsect1>
104102

doc/src/sgml/rules.sgml

-3
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,6 @@ CREATE MATERIALIZED VIEW sales_summary AS
961961
FROM invoice
962962
WHERE invoice_date &lt; CURRENT_DATE
963963
GROUP BY
964-
seller_no,
965-
invoice_date
966-
ORDER BY
967964
seller_no,
968965
invoice_date;
969966

0 commit comments

Comments
 (0)