Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcqsd-0000wg-0K for pgsql-docs@arkaria.postgresql.org; Tue, 19 Oct 2021 15:18:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mcqsb-0002SV-Tu for pgsql-docs@arkaria.postgresql.org; Tue, 19 Oct 2021 15:18:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcqrH-0008Li-39 for pgsql-docs@lists.postgresql.org; Tue, 19 Oct 2021 15:16:56 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcqrD-0003rE-KZ for pgsql-docs@lists.postgresql.org; Tue, 19 Oct 2021 15:16:54 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C1D985C010A; Tue, 19 Oct 2021 11:16:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 19 Oct 2021 11:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=MuBby6CrMlGB4hI++oJh/vBRv2qbb59J/QxYe/c6pkw=; b=e4qb9mBg XJ6biOdFh+NnI+5T+DQtKDi6rzJwq+/Uf2yMhB2qmdmxwcoWSV6Tu9IXCp+wYVge pNAFlR066S5h0oTiU6rtqRHHITCSxZd17YZGBQ5bg8U/NBRFgpFhpBcB+7kQmfa1 UCjlCsr4+NyScOOVpwulxm3EL6VnpCX4gdmwSkAQ9ufLowHCWmTWXJVp7vCuiqHi SSLRB2yljKAWnndgkFh0sDO7WRTXeu63clAYWk4ZqgKmBd/Bu+f33x2qwC4AUBeX OjWEcJ4Ruz09U9X0ZJHQrrC/jFpmMQpl5AVnAk80aNdkGivu+rBeDGublHANDaRh 1v7zONkkCe8+eQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvvddgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehmkeerredttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeetvdfhteeuueekfefhfedugeffhfehhfdvleffleetkeeg geefhffggeekjedtudenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Oct 2021 11:16:47 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id CF4362A079C; Tue, 19 Oct 2021 12:16:44 -0300 (-03) Date: Tue, 19 Oct 2021 12:16:44 -0300 From: Alvaro Herrera To: Michael Paquier Cc: Euler Taveira , "nikolai.berkoff" , "pgsql-docs@lists.postgresql.org" Subject: Re: ALTER TABLE ... SET DATA TYPE removes statistics Message-ID: <202110191516.eufiqzha2etw@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vnw3jy72vl6ecofi" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vnw3jy72vl6ecofi Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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/ --vnw3jy72vl6ecofi Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="datatype.patch" 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 numeric_literal, REM clause must be provided if there is no implicit or assignment cast from old to new type. + + + When this form is used, the column's statistics are removed, + so running ANALYZE on the table afterwards + is recommended. + --vnw3jy72vl6ecofi--