Skip to content

Commit 3f43dcc

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 2c3fddc commit 3f43dcc

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

doc/src/sgml/ref/refresh_materialized_view.sgml

Lines changed: 4 additions & 6 deletions
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-
<xref linkend="sql-cluster"/>
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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,6 @@ CREATE MATERIALIZED VIEW sales_summary AS
956956
FROM invoice
957957
WHERE invoice_date &lt; CURRENT_DATE
958958
GROUP BY
959-
seller_no,
960-
invoice_date
961-
ORDER BY
962959
seller_no,
963960
invoice_date;
964961

0 commit comments

Comments
 (0)