Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 68BCC2E326E; Sun, 20 Jan 2008 17:02:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 27438-03; Sun, 20 Jan 2008 17:02:42 -0400 (AST) Received: from westnet.com (westnet.com [216.187.52.2]) by postgresql.org (Postfix) with ESMTP id 69FFF2E2D95; Sun, 20 Jan 2008 16:55:57 -0400 (AST) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id m0KKtsop023338; Sun, 20 Jan 2008 15:55:54 -0500 (EST) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id m0KKtsM1023333; Sun, 20 Jan 2008 15:55:54 -0500 (EST) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Sun, 20 Jan 2008 15:55:54 -0500 (EST) From: Greg Smith X-X-Sender: gsmith@westnet.com To: Alvaro Herrera cc: pgsql-docs@postgresql.org, Hackers Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent In-Reply-To: <20080120195519.GD22740@alvh.no-ip.org> Message-ID: References: <20080120195519.GD22740@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/22 X-Sequence-Number: 4751 On Sun, 20 Jan 2008, Alvaro Herrera wrote: > Is the bgwriter_lru_multiplier parameter a limit on the number to scan > or to write? GUC and docs seem to contradict one another. It adjusts the target for how many clean buffers it wants to either find or create. This always increases the number of buffers scanned, and that's what the GUC description says. Since a clean buffer can either be a) a reusable candidate found by scanning or b) a buffer that is written, on average it's adjusting up the number of writes as well. But it's not guaranteed to--you could have a case where it just found all the buffers it needed and never wrote a single one. > Unless limited by bgwriter_lru_maxpages, the number > of dirty buffers written in each round is determined by reference > to the number of new buffers that have been needed by server > processes during recent rounds. This number is multiplied by > bgwriter_lru_multiplier to arrive at the estimate > of the number of buffers that will be needed during the next round. There is nothing incorrect here, it's just not as clear as it could be. Here's a V2 that tries to clear that up: Unless limited by bgwriter_lru_maxpages, the number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds. The recent need is multiplied by bgwriter_lru_multiplier to arrive at the estimate of the number of buffers that will be needed during the next round. Buffers are written to meet that need if there aren't enough reusable ones found while scanning. -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD