Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j2KxG-00055w-NS for pgsql-general@arkaria.postgresql.org; Thu, 13 Feb 2020 20:19:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j2KxF-0006ru-0I for pgsql-general@arkaria.postgresql.org; Thu, 13 Feb 2020 20:19:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j2KxD-0006qk-5u for pgsql-general@lists.postgresql.org; Thu, 13 Feb 2020 20:19:20 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j2Kx7-0000Ug-Ro for pgsql-general@lists.postgresql.org; Thu, 13 Feb 2020 20:19:18 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 3882EAA5; Thu, 13 Feb 2020 15:19:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 13 Feb 2020 15:19:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=d bZCEY1rX/8HVBUgloeiX6HAEiuB5lQ38b4U6PYnASk=; b=GydgySnByw708P8/p qOJly0i0TjqkH+NJ2ZvDlVaOdvwOnKxRumeBjBXfZOY38OGNhJVCuc+nCe3ldEs8 tfCSBPtHazZDvTiZONa4JYxDBT7PzeDbe59AxwNcJZ2qWEpdtoDInlGs8DPWb86f xwECvkN8w4EnLSE7YoJEskK0Nwf1JOG48nrjgDFThdoOQw48SWoy7iSxZMMkuxLU rn7H0Niy3O+MdYLKoysLCt0zmX+C5Z5bLuk55UlJemmIeZPFrd0H8QkR0nXBdpLx WW3oEPzCcel33/Wx/D2Dfoy39/NY8ZoY0aDSFQq0YYb8ZMw9izhi16O8cDgvFPTb ixZUQ== 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:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=dbZCEY1rX/8HVBUgloeiX6HAEiuB5lQ38b4U6PYnA Sk=; b=rPwcGueT4/64DBGr7YlvAgjLTt2n/N3FVK5IhnqLsABpETk6n+hQXUeOe kTidEQpPBM7HGif5pK0Myu+zhVCfVQ6tFCtA8Oge8Q+s6nj91zQssleCqemv45g5 0JWr1CwCS5JSmXpIBrVAhRTiGl6zsTyCOXtizWGnwzFKzwfMvqwrrEzWc1qxgJHt +dZ3eRdZwxQr25PuuA6eYds5ngHNSqAQpi299VBo0gXksxJFOzA6RoY4alcA/42l k+Rx64RLDvESh+t9RdhRnlZBd6Dxo9ofk/4X4PFvWqEkML4J6cLKha8pc3fiknUN D3kYCyh7btI4UkGkLGDQJ7a4FOF7A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieekgddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdgsuhgtrghrughordho rhhgnecukfhppeejuddrvdduvddruddvledrudelfeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 06FE13280065; Thu, 13 Feb 2020 15:19:08 -0500 (EST) Subject: =?UTF-8?Q?Re=3a_pg=5fupgrade_=e2=80=94link_does_it_remove_table_blo?= =?UTF-8?Q?at?= To: Jason Ralph , Michael Lewis Cc: "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: Date: Thu, 13 Feb 2020 12:19:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/13/20 11:07 AM, Jason Ralph wrote: > >There is more than one type of statistics though. Stats on the > distribution of data is easily recreated with analyze table_name or > analyzing the whole >database. What about the stats on how many rows > have been inserted or updated since the last (auto)vacuum and that will > be used to trigger autovacuum? >Are those set back to zero by an > upgrade? I would assume usage counts like how many times an index scan > has been done would be reset, but if the >numbers in pg_stat_user_tables > like n_tup_upd or n_tup_del are zero'd out during an upgrade, than it > would seem like a manual vacuum would always be a >good idea to ensure a > table wasn't 99% of the way to needing one and then the stats got reset > by upgrading. > > I agree @Michael Lewis , thank you for this > comment. > > I am thinking a vacuum full is what I am going to need.  Or pg_dump / > pg_restore. I have tuned auto vacuum after the upgrade to be aggressive, > it finishes fine after a couple hours on a large table, statistics look > good on the pg_stat_user_tables.  However, when I run the bloat check > from the wiki https://wiki.postgresql.org/wiki/Show_database_bloat it > still shows bloat.  Thinking it may be left over from before the > pg_upgrade and auto vacuum tuning. What values are you getting? The script you are using comes from this: https://bucardo.org/check_postgres/check_postgres.pl.html#bloat "If you want to output the bloat ratio instead (how many times larger the relation is compared to how large it should be),..." So I'm pretty sure bloat is where tbloat > 1.0. > > Best, > > *Jason Ralph* > > *From:* Michael Lewis > *Sent:* Thursday, February 13, 2020 1:02 PM > *To:* Adrian Klaver > *Cc:* Jason Ralph ; > pgsql-general@lists.postgresql.org > *Subject:* Re: pg_upgrade —link does it remove table bloat > > There is more than one type of statistics though. Stats on the > distribution of data is easily recreated with analyze table_name or > analyzing the whole database. What about the stats on how many rows have > been inserted or updated since the last (auto)vacuum and that will be > used to trigger autovacuum? Are those set back to zero by an upgrade? I > would assume usage counts like how many times an index scan has been > done would be reset, but if the numbers in pg_stat_user_tables like > n_tup_upd or n_tup_del are zero'd out during an upgrade, than it would > seem like a manual vacuum would always be a good idea to ensure a table > wasn't 99% of the way to needing one and then the stats got reset by > upgrading. > > This message contains confidential information and is intended only for > the individual named. If you are not the named addressee you should not > disseminate, distribute or copy this e-mail. Please notify the sender > immediately by e-mail if you have received this e-mail by mistake and > delete this e-mail from your system. E-mail transmission cannot be > guaranteed to be secure or error-free as information could be > intercepted, corrupted, lost, destroyed, arrive late or incomplete, or > contain viruses. The sender therefore does not accept liability for any > errors or omissions in the contents of this message, which arise as a > result of e-mail transmission. If verification is required please > request a hard-copy version. -- Adrian Klaver adrian.klaver@aklaver.com