pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Euler Taveira <euler@eulerto.com>
Cc: nikolai.berkoff <nikolai.berkoff@pm.me>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: ALTER TABLE ... SET DATA TYPE removes statistics
Date: Tue, 19 Oct 2021 12:16:44 -0300
Message-ID: <202110191516.eufiqzha2etw@alvherre.pgsql> (raw)
In-Reply-To: <YW5BDcUqz8kucDPr@paquier.xyz>

On 2021-Oct-19, Michael Paquier wrote:

> On Mon, Oct 18, 2021 at 05:15:59PM -0300, Euler Taveira wrote:
> > I agree that it might surprise an user and it would be good to document it.
> > However, it does not belong to the description. I would add it to the Notes
> > section at the end of the ALTER TABLE page.
> 
> No objections to the suggested addition and the location of the
> addition (paragraph of SET DATA TYPE rather than "Notes"), but I think
> that the phrasing could be better:
> "The column's statistics are removed, hence a follow-up ANALYZE is
> suited to update the statistics to the new column type."

Dunno, putting it in the middle of the existing paragraph looks odd to
me.  I would put it in a separate one instead, as in the attached.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/

Attachments:

  [text/x-diff] datatype.patch (645B, ../202110191516.eufiqzha2etw@alvherre.pgsql/2-datatype.patch)
  download | inline diff:
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 81291577f8..86fc15c8b3 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -198,6 +198,12 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       clause must be provided if there is no implicit or assignment
       cast from old to new type.
      </para>
+
+     <para>
+      When this form is used, the column's statistics are removed,
+      so running <command>ANALYZE</command> on the table afterwards
+      is recommended.
+     </para>
     </listitem>
    </varlistentry>
 

view thread (8+ messages)  latest in thread

Message-ID: <202110191516.eufiqzha2etw@alvherre.pgsql>
Permalink:  ../202110191516.eufiqzha2etw@alvherre.pgsql/
Also on:    postgresql.org/message-id/202110191516.eufiqzha2etw@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: alvherre@alvh.no-ip.org, michael@paquier.xyz, euler@eulerto.com, nikolai.berkoff@pm.me, pgsql-docs@lists.postgresql.org
  Subject: Re: ALTER TABLE ... SET DATA TYPE removes statistics
  In-Reply-To: <202110191516.eufiqzha2etw@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox