Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3rpS-0001pE-PC for pgsql-general@arkaria.postgresql.org; Wed, 04 Apr 2018 23:28:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f3rpP-0004iz-Oa for pgsql-general@arkaria.postgresql.org; Wed, 04 Apr 2018 23:28:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3rpP-0004hM-Cn for pgsql-general@lists.postgresql.org; Wed, 04 Apr 2018 23:28:31 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f3rpM-00048Y-KR for pgsql-general@postgresql.org; Wed, 04 Apr 2018 23:28:30 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1f3rpL-0008Va-SS; Wed, 04 Apr 2018 19:28:27 -0400 Date: Wed, 4 Apr 2018 19:28:27 -0400 From: Bruce Momjian To: Jerry Sievers Cc: pgsql-general@postgresql.org Subject: Re: PgUpgrade bumped my XIDs by ~50M? Message-ID: <20180404232827.GD19574@momjian.us> References: <87sh8a7gh1.fsf@jsievers.enova.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sh8a7gh1.fsf@jsievers.enova.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Apr 4, 2018 at 05:29:46PM -0500, Jerry Sievers wrote: > We have a large >20TB system just pg_upgraded from 9.5 to 9.6 as per the > versions shown below. > > The system does <5M transactions/day based on sum(commit + abort) from > pg_stat_database. > > Autovac is running all possible threads now and upon investigating I see > that thousands of tables are now above the freeze threshold. Same > tables all appear ~50M xids older than they did yesterday and the > upgrade was less than 24 hours ago. > > I have a "safety" snap made of the system before upgrade that can be > used for inspection. > > Any ideas why the age jump? Uh, you can read how pg_upgrade handles frozen xids in pg_upgrade.c: https://doxygen.postgresql.org/pg__upgrade_8c_source.html#l00543 I am not sure what would have caused such a jump. pg_upgrade brings over the frozen values for each table, and sets the server's frozen counter to match the old one. If you run 'pg_dump --binary-upgrade' you will see the frozen xids being transfered: -- For binary upgrade, set heap's relfrozenxid and relminmxid UPDATE pg_catalog.pg_class SET relfrozenxid = '558', relminmxid = '1' WHERE oid = 'public.test'::pg_catalog.regclass; Is it possible that pg_upgrade used 50M xids while upgrading? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +