Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UaUUS-0003r3-8C for pgsql-performance@arkaria.postgresql.org; Thu, 09 May 2013 17:18:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UaUUR-0004vM-85 for pgsql-performance@arkaria.postgresql.org; Thu, 09 May 2013 17:18:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UaUUQ-0004vG-7f for pgsql-performance@postgresql.org; Thu, 09 May 2013 17:18:46 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UaUUM-0004NC-6X for pgsql-performance@postgresql.org; Thu, 09 May 2013 17:18:45 +0000 Received: from anarazel.de (p5DDC5AA3.dip0.t-ipconnect.de [93.220.90.163]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0MJU0R-1UXSLz1hQR-00336z; Thu, 09 May 2013 19:18:40 +0200 Received: by anarazel.de (Postfix, from userid 1000) id 88BDD1C0102; Thu, 9 May 2013 19:18:39 +0200 (CEST) Date: Thu, 9 May 2013 19:18:39 +0200 From: Andres Freund To: Josh Berkus Cc: postgres performance list Subject: Re: Setting vacuum_freeze_min_age really low Message-ID: <20130509171839.GA27844@awork2.anarazel.de> References: <5150B415.9060907@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5150B415.9060907@agliodbs.com> X-Provags-ID: V02:K0:8MeD6zZRG/fGep401BiMomyIHOryidsJCD30BIb1Yt4 1nO8P04CCf6UIccWt60mDeFEZEW7rMsjxMsR4kP6x+yodQZIlX N/ui3s7DHD3F3o1uZm5cSaw/1ISEBNxKZcoePNvTrTYWsJuDRR PLEbn8J0an2wlka04E6oJbQL5UIBIoYoWg0u1kxbiV9iYHmjDS vTLIjYECbOa4+XkfIbO7nSt2g6iNBQ+phT3vK8bdUwNhKkZ06r KRiqL/DpIqhJwqEy1lhhjJ6rYMeiunHk+T1YDw2CWRHN4gzlhQ NgmtyxdPIzeDJO1+CNAzja63Wi7V0sMemWQ1dlH85coGgKh6NE UGgVeaxwsXUMKl4m+FTMXySQgpiwBoFTb/1+fbwCw X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi, On 2013-03-25 13:31:17 -0700, Josh Berkus wrote: > In the past, setting vacuum_freeze_min_age (vfma) really low (say to > 10000 or 50000) would have caused lots of extra writing work due to > dirtying extra pages for freezing. This has been our stated reason to > keep vfma high, despite the obvious advantage of freezing tuples while > they're still in the cache. > > With the visibility map, though, vfma should only be dirtying pages > which vacuum is already visiting because there's dirty tuples on the > page. That is, pages which vacuum will probably dirty anyway, freezing > or not. (This is assuming one has applied the 9.2.3 update.) > > Given that, it seems like the cost of lowering vfma *should* be > marginal. The only extra work done by a lower vfma should be: > > 1. extra cpu time to put in the froxenXIDs on vacuumed pages, and > 2. dirtying the minority of pages which vacuum decided to scan, but not > write to. It will also often enough lead to a page being frozen repeatedly which causes unneccessary IO and WAL traffic. If a page contains pages from several transactions its not unlikely that some tuples are older and some are newer than vfma. That scenario isn't unlikely because of two scenarios: - INSERT/UPDATE reusing space on older pages where tuples have been deleted. - When a backend extends a relation that page is *not* known to have free space to other relations. Until vacuum comes along for the first time only this backend will use its space. Given that busy clusters frequently burn loads of xids per second it is not uncommon to have a wide range of xids on such a page. > And are there other costs I'm not thinking of? I think (but am not 100% sure right now) it would have another rather big cost: When a page contains freezable items, as determined by freeze_min_age, and we are doing a full table scan we won't skip buffers that we can't lock for cleanup. Instead we will wait and then lock them for cleanup. So I think this would be rather noticeably impact the speed of vacuum (since it waits more often) and concurrency (since we lock more buffers than before, even if they are actively used). Makes sense? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance