Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 0EBAF2E006F for ; Tue, 27 May 2008 18:28:18 -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 50852-07 for ; Tue, 27 May 2008 18:28:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from master.phlo.org (master.phlo.org [213.147.174.89]) by developer.postgresql.org (Postfix) with ESMTP id 0EE652E0079 for ; Tue, 27 May 2008 18:28:11 -0300 (ADT) Received: (qmail 25867 invoked by uid 0); 27 May 2008 21:28:09 -0000 Received: from unknown (HELO phlook.local) (fgp@[10.105.0.26]) (envelope-sender ) by imap.phlo.org (qmail-ldap-1.03) with SMTP for ; 27 May 2008 21:28:09 -0000 Message-ID: <483C7CE8.2090404@phlo.org> Date: Tue, 27 May 2008 23:28:08 +0200 From: "Florian G. Pflug" User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 To: Simon Riggs CC: pgsql-hackers Subject: Re: Hint Bits and Write I/O References: <1211916951.4489.232.camel@ebony.site> In-Reply-To: <1211916951.4489.232.camel@ebony.site> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/852 X-Sequence-Number: 118851 Simon Riggs wrote: > After some discussions at PGCon, I'd like to make some proposals for > hint bit setting with the aim to reduce write overhead. > > Currently, when we see an un-hinted row we set the bit, if possible and > then dirty the block. > > If we were to set the bit but *not* dirty the block we may be able to > find a reduction in I/O. In many cases this would make no difference at > all, since we often set hints on an already dirty block. In other cases, > particularly random INSERTs, UPDATEs and DELETEs against large tables > this would reduce I/O, though possibly increase accesses to clog. Hm, but the io overhead of hit-bit setting occurs only once, while the pressure on the clog is increased until we set the hint-bit. This looks like not writing the hit-bit update to disk results in worse throughput unless there are many updated, and only very few selects. But not too many updates either, because if a page gets hit by tuple updates faster than the bgwriter writes it out, you won't waste any io on hit-bit-only writes either. That might turn out to be a pretty slim window which actually shows substantial IO savings... > My proposal is to have this as a two-stage process. When we set the hint > on a tuple in a clean buffer we mark it BM_DIRTY_HINTONLY, if not > already dirty. If we set a hint on a buffer that is BM_DIRTY_HINTONLY > then we mark it BM_DIRTY. > > The objective of this is to remove effects of single index accesses. So effectively, only the first hit-bit update hitting a previously clean buffer gets treated specially - the second hit-bit update flags the buffer as dirty, just as it does now? That sounds a bit strange - why is it exactly the *second* write that triggers the dirtying? Or did I missunderstand what you wrote? regards, Florian Pflug