Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8V63-0007aT-C8 for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2015 14:59:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z8V62-0000Qz-S0 for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2015 14:59:14 +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.84) (envelope-from ) id 1Z8V56-0007xH-9u for pgsql-bugs@postgresql.org; Fri, 26 Jun 2015 14:58:16 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z8V53-0008L3-RP for pgsql-bugs@postgresql.org; Fri, 26 Jun 2015 14:58:15 +0000 Received: from intern.anarazel.de (unknown [37.82.95.140]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id C3A37860001; Fri, 26 Jun 2015 16:58:12 +0200 (CEST) Date: Fri, 26 Jun 2015 16:58:11 +0200 From: Andres Freund To: Matthew Seaman Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13472: VACUUM ANALYZE hangs on certain tables Message-ID: <20150626145811.GI4797@alap3.anarazel.de> References: <20150626110830.3881.92624@wrigleys.postgresql.org> <20150626135342.GG4797@alap3.anarazel.de> <558D6429.7080400@adestra.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <558D6429.7080400@adestra.com> X-Pg-Spam-Score: 4.4 (++++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, On 2015-06-26 15:39:37 +0100, Matthew Seaman wrote: > On 06/26/15 14:53, Andres Freund wrote: > > Hello,m > > > > On 2015-06-26 11:08:30 +0000, matthew.seaman@adestra.com wrote: > >> We have two tables which we have not been able to vacuum sucessfully on one > >> of our database servers. The vacuum process just hangs almost > >> instantaneously after issuing the 'VACUUM ANALYZE' command. > > > > Hm. Is there a chance that your application uses cursors? > > We do use cursors, but not all the time. They're only used for some > ad-hoc data exports that run occasionally. There's no cursors in use on > that database at the moment. Hm. And there was none when the vacuum was hanging last? What level of concurrency do you have? Is it possible/likely that there is a number of accesses to the same page going on all the time? How large is that table? > > Could you send the output of: > > SELECT oid::regclass, txid_current(), relfrozenxid, age(relfrozenxid) > > FROM pg_class > > WHERE oid = 'your relation'::regclass; > > > > My theory is that there's a page that needs to be frozen, but a pin on > > the page exists, preventing the cleanup lock from being acquired. Or > > rather delaying it long enough that little progress is made. > > Certainly: > > amf_more2=# SELECT oid::regclass, txid_current(), relfrozenxid, > age(relfrozenxid) > FROM pg_class > WHERE oid = 'page_tags'::regclass; > oid | txid_current | relfrozenxid | age > -----------+--------------+--------------+----------- > page_tags | 633097656 | 370306842 | 262790814 > (1 row) Hm. So that table is already considerably older than the default autovacuum_freeze_max_age (200000000). If indeed pins are the problem they already migh have held up autovacuum for a while. Is that the value you currently have configured? One easy way to confirm whether this is the root cause would be to change autovacuum_freeze_max_age to be significantly higher (just uses a bit more disk space, but is also more efficient overall); but that requires a restart which I guess you're not looking forward to doing? Greetings, Andres Freund -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs