Re: Doc: Add note for running ANALYZE after ALTER TABLE ... SET EXPRESSION

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: Doc: Add note for running ANALYZE after ALTER TABLE ... SET EXPRESSION
Дата
Msg-id CAHGQGwG5yrrwnjoOjuN7f6BXCQx5XkE1Hyzq+avnGmSknwLT_g@mail.gmail.com
обсуждение исходный текст
Ответ на Doc: Add note for running ANALYZE after ALTER TABLE ... SET EXPRESSION  (Yugo Nagata <nagata@sraoss.co.jp>)
Ответы Re: Doc: Add note for running ANALYZE after ALTER TABLE ... SET EXPRESSION
Список pgsql-hackers
On Mon, Aug 4, 2025 at 3:14 PM Yugo Nagata <nagata@sraoss.co.jp> wrote:
>
> Hi,
>
> The documentation recommends running ANALYZE after the "ALTER TABLE ... SET DATA TYPE"
> command since the statistics will become wrong after that.
>
> That same thing can be applied to "ALTER TABLE ... SET EXPRESSION" commands,
> but that is not described in the documentation, so I've attached a patch
> to add this statement.

+1

+      When this form is used, the column's statistics are removed,
+      so running <link linkend="sql-analyze"><command>ANALYZE</command></link>
+      on the table afterwards is recommended.

ANALYZE is not needed for virtual generated columns, since they
don't have statistics in the first place? If so, would it be clearer to
explicitly mention that? How about rephrasing it like this?

------------------------------
When this form is used on a stored generated column, its statistics
are removed, so running <link linkend="sql-analyze"><command>ANALYZE
</command></link> on the table afterwards is recommended.
For a virtual generated column, <command>ANALYZE</command>
is not necessary because such columns never have statistics.
------------------------------

Regards,

--
Fujii Masao



В списке pgsql-hackers по дате отправления: