Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 20D7C2E0060 for ; Sat, 19 Apr 2008 16:29:52 -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 35362-06 for ; Sat, 19 Apr 2008 16:29:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from westnet.com (westnet.com [216.187.52.2]) by developer.postgresql.org (Postfix) with ESMTP id 30DD62E002C for ; Sat, 19 Apr 2008 16:29:49 -0300 (ADT) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id m3JJTcXt017435; Sat, 19 Apr 2008 15:29:38 -0400 (EDT) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id m3JJTcIR017431; Sat, 19 Apr 2008 15:29:38 -0400 (EDT) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Sat, 19 Apr 2008 15:29:38 -0400 (EDT) From: Greg Smith X-X-Sender: gsmith@westnet.com To: James Mansion cc: Marinos Yannikos , pgsql-performance@postgresql.org Subject: Re: Background writer underemphasized ... In-Reply-To: <480A0A5D.8060604@mansionfamily.plus.com> Message-ID: References: <480619CA.2080904@geizhals.at> <48079AED.8090906@geizhals.at> <480A0A5D.8060604@mansionfamily.plus.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/289 X-Sequence-Number: 29782 On Sat, 19 Apr 2008, James Mansion wrote: > But isn't it the case that while using background writer might result in > *slightly* more data to write (since data that is updated several times > might actually be sent several times), the total amount of data in both > cases is much the same? Really depends on your workload, how many wasted writes there are. It might be significant, it might only be slight. > And if the buffer backed up in the BGW case, wouldn't it also back up > (more?) if the writes are deferred? And in fact by sending earlier, the > real bottleneck (the disks) could have been getting on with it and > staring their IO earlier? If you write a giant block of writes, those tend to be sorted by the OS and possibly the controller to reduce total seeks. That's a pretty efficient write and it can clear relatively fast. But if you're been trickling writes in an unstructured form and in low volume, there can be a stack of them that aren't sorted well blocking the queue from clearing. With a series of small writes, it's not that difficult to end up in a situation where a controller cache is filled with writes containing a larger seek component than you'd have gotten had you written in larger blocks that took advantage of more OS-level elevator sorting. There's actually a pending patch to try and improve this situation in regards to checkpoint writes in the queue. Seeks are so slow compared to more sequential writes that you really can end up in the counterintuitive situation that you finish faster by avoiding early writes, even in cases when the disk is the bottleneck. -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD