Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id AFBE46502B0 for ; Thu, 20 Nov 2008 15:37:26 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 69109-05 for ; Thu, 20 Nov 2008 15:37:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from vms173001pub.verizon.net (vms173001pub.verizon.net [206.46.173.1]) by mail.postgresql.org (Postfix) with ESMTP id 3A17D650154 for ; Thu, 20 Nov 2008 15:37:23 -0400 (AST) Received: from ridley.home ([173.67.13.101]) by vms173001.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KAN00HSDD5WP3O1@vms173001.mailsrvcs.net> for pgsql-admin@postgresql.org; Thu, 20 Nov 2008 13:37:09 -0600 (CST) Date: Thu, 20 Nov 2008 14:37:06 -0500 From: Robert Treat Subject: Re: Is it safe to reset relfrozenxid without using vacuum? In-reply-to: <20081118214623.GT4141@alvh.no-ip.org> To: pgsql-admin@postgresql.org Cc: Alvaro Herrera , Arctic Toucan , tgl@sss.pgh.pa.us Message-id: <200811201437.06925.xzilla@users.sourceforge.net> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit Content-disposition: inline References: <20081118214623.GT4141@alvh.no-ip.org> User-Agent: KMail/1.9.10 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200811/129 X-Sequence-Number: 30783 On Tuesday 18 November 2008 16:46:23 Alvaro Herrera wrote: > Arctic Toucan wrote: > > If I "know" that there are no more inserts going into those > > partitioned tables, can I do a bulk change of their relfrozenxids > > setting them back 500million transactions without causing problems? > > This will mean that the relfrozenxid is not representative of the row > > versions, but does that matter in this case(Essentially static > > stables)? > > The safest most current value you can use is that of the oldest > transaction currently running (also known as RecentXmin in the code). > If you choose anything older than that you're safe too. > > I don't think you can obtain RecentXmin in SQL (short of writing a C > function) > Hmm, I have a very similar problem on some of our larger dbs with years of archival data. I'm of the thought that someday I will have a problem that my db would grow large enough that it takes longer to vacuum the archival data (for purposes of advancing relfrozenxid, the data is never modified) than it takes to run through 2 billion transactions. Sounds like the solution might be to write such a C function to just update this directly and run that in cron, and avoid the vacuum mess. -- Robert Treat Conjecture: http://www.xzilla.net Consulting: http://www.omniti.com