Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 899012E003E for ; Fri, 2 May 2008 13:41:10 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74151-01 for ; Fri, 2 May 2008 13:41:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id 4C43F2E003B for ; Fri, 2 May 2008 13:41:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m42Gewbw007392; Fri, 2 May 2008 12:40:58 -0400 (EDT) To: Alvaro Herrera cc: Ian Westmacott , pgsql-admin@postgresql.org Subject: Re: 8.1.8 autovacuum missing databases In-reply-to: <20080502161709.GH2320@alvh.no-ip.org> References: <1209574908.22509.6.camel@vega.intellivid.com> <20185.1209575233@sss.pgh.pa.us> <1209576488.22509.9.camel@vega.intellivid.com> <22093.1209588237@sss.pgh.pa.us> <1209646882.16174.15.camel@vega.intellivid.com> <7698.1209650248@sss.pgh.pa.us> <1209664799.16174.51.camel@vega.intellivid.com> <17328.1209667453@sss.pgh.pa.us> <1209668403.16174.60.camel@vega.intellivid.com> <17606.1209669106@sss.pgh.pa.us> <20080502161709.GH2320@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Fri, 02 May 2008 12:17:09 -0400" Date: Fri, 02 May 2008 12:40:58 -0400 Message-ID: <7391.1209746458@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/22 X-Sequence-Number: 29106 Alvaro Herrera writes: > I'm wondering if there could be a hidden bug in the age arithmetic > somehow -- say because it's using unsigned comparison of signed > variables, or the Max() macro is flawed, or something weird like that. Umm ... actually, there's a bug in the hand calculations I did at the start of this thread. The threshold that 8.1 uses is (int32) ((MaxTransactionId >> 3) * 3 - 100000) which works out to 1610512733, which is considerably more than the 300M or so age() values that Ian is showing. I had somehow convinced myself that it was less and he should be getting whole-db vacuums, but in reality he shouldn't yet. It's only in 8.2 and up that we have a much smaller threshold for trying to advance datfrozenxid. So actually, what we are looking at is the not-whole-db logic, and it's working exactly as designed. The only unexpected behavior was the choice not to vacuum some of the DBs, which we now know is explained by their having a last_autovac_time in the future. Perhaps it is worth adding a defense to autovac to not believe last autovac times that are in the future, since the system clock is not under our control and could go backwards. Other than that I don't think there's any bug here. regards, tom lane