Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e65e77

Browse files
committed
doc: Recommend ANALYZE after ALTER TABLE ... SET EXPRESSION AS.
ALTER TABLE ... SET EXPRESSION AS removes statistics for the target column,so running ANALYZE afterward is recommended. But this was previously notdocumented, even though a similar recommendation exists forALTER TABLE ... SET DATA TYPE, which also clears the column's statistics.This commit updates the documentation to include the ANALYZE recommendationfor SET EXPRESSION AS.Since v18, virtual generated columns are supported, and these columns neverhave statistics. Therefore, ANALYZE is not needed after SET DATA TYPE orSET EXPRESSION AS when used on virtual generated columns. This commit alsoupdates the documentation to clarify that ANALYZE is unnecessary in such cases.Back-patch the ANALYZE recommendation for SET EXPRESSION AS to v17where the feature was introduced, and the note about virtual generatedcolumns to v18 where those columns were added.Author: Yugo Nagata <nagata@sraoss.co.jp>Reviewed-by: Fujii Masao <masao.fujii@gmail.com>Discussion:https://postgr.es/m/20250804151418.0cf365bd2855d606763443fe@sraoss.co.jpBackpatch-through: 17
1 parent9b681e2 commit3e65e77

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎doc/src/sgml/ref/alter_table.sgml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
210210
When this form is used, the column's statistics are removed,
211211
so running <link linkend="sql-analyze"><command>ANALYZE</command></link>
212212
on the table afterwards is recommended.
213+
For a virtual generated column, <command>ANALYZE</command>
214+
is not necessary because such columns never have statistics.
213215
</para>
214216
</listitem>
215217
</varlistentry>
@@ -271,6 +273,15 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
271273
in a stored generated column is rewritten and all the future changes
272274
will apply the new generation expression.
273275
</para>
276+
277+
<para>
278+
When this form is used on a stored generated column, its statistics
279+
are removed, so running
280+
<link linkend="sql-analyze"><command>ANALYZE</command></link>
281+
on the table afterwards is recommended.
282+
For a virtual generated column, <command>ANALYZE</command>
283+
is not necessary because such columns never have statistics.
284+
</para>
274285
</listitem>
275286
</varlistentry>
276287

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp