Skip to content

Commit 3d81cdf

Browse files
MasaoFujiihopebo
authored andcommitted
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 not documented, even though a similar recommendation exists for ALTER TABLE ... SET DATA TYPE, which also clears the column's statistics. This commit updates the documentation to include the ANALYZE recommendation for SET EXPRESSION AS. Since v18, virtual generated columns are supported, and these columns never have statistics. Therefore, ANALYZE is not needed after SET DATA TYPE or SET EXPRESSION AS when used on virtual generated columns. This commit also updates the documentation to clarify that ANALYZE is unnecessary in such cases. Back-patch the ANALYZE recommendation for SET EXPRESSION AS to v17 where the feature was introduced, and the note about virtual generated columns to v18 where those columns were added. Author: Yugo Nagata <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 17 (cherry picked from commit 753177604b33df4cb9f32dd9db6f829ae733c41f)
1 parent 786c5d4 commit 3d81cdf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/src/sgml/ref/alter_table.sgml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
265265
in the column is rewritten and all the future changes will apply the new
266266
generation expression.
267267
</para>
268+
269+
<para>
270+
When this form is used, the column's statistics are removed,
271+
so running <link linkend="sql-analyze"><command>ANALYZE</command></link>
272+
on the table afterwards is recommended.
273+
</para>
268274
</listitem>
269275
</varlistentry>
270276

0 commit comments

Comments
 (0)