Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 8FD342E00D6 for ; Wed, 28 May 2008 08:29:26 -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 39977-08-3 for ; Wed, 28 May 2008 08:29:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail136077.authsmtp.com (outmail136077.authsmtp.com [62.13.136.77]) by developer.postgresql.org (Postfix) with ESMTP id 2C4942E00DC for ; Wed, 28 May 2008 08:29:11 -0300 (ADT) Received: from mail.authsmtp.com (mail.authsmtp.com [62.13.128.187]) by punt2.authsmtp.com (8.14.2/8.13.8/Kp) with ESMTP id m4SBT3OM022439; Wed, 28 May 2008 12:29:03 +0100 (BST) Received: from [192.168.0.3] (85-211-226-243.dyn.gotadsl.co.uk [85.211.226.243]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m4SBT1iA079721; Wed, 28 May 2008 12:29:01 +0100 (BST) Subject: Re: Hint Bits and Write I/O From: Simon Riggs To: Gregory Stark Cc: Tom Lane , pgsql-hackers In-Reply-To: <87hccispv7.fsf@oxford.xeocode.com> References: <1211916951.4489.232.camel@ebony.site> <15901.1211931165@sss.pgh.pa.us> <87hccispv7.fsf@oxford.xeocode.com> Content-Type: text/plain Date: Wed, 28 May 2008 12:31:33 +0100 Message-Id: <1211974293.4489.417.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 45a4b25c-2ca9-11dd-8782-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFag1bYFhI HGQLW1xEUV97W2p/ awgfZQBDYEtPQQdo VlZLRlFNFgBqBAMB SEMaMWsWdlw3eHl5 YkRjEHJbWEc0cUMs RhxWED4bZzQxYX0e URQMagtTeAFXfh9E a1h6AHAKZjZWKBg1 TUcTPjYtdR9eND8d SwcBZW0IQFoGVh97 YHhs X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:1045/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/865 X-Sequence-Number: 118864 On Wed, 2008-05-28 at 06:08 -0400, Gregory Stark wrote: > "Tom Lane" writes: > > > (Although that argument might not hold water for a bulk seqscan: you'll > > have hinted all the tuples and then very possibly throw the page away > > immediately. > > That seems like precisely the case where we don't want to dirty the buffer. (1) > > So counting the hints and eventually deciding we did > > enough to justify dirtying the page might be worth doing.) > > What if we counted how many hint bits were *not* set? I feel like the goal > should be to dirty the buffer precisely once when all the bits can be set. (2) Agreed. I think the difficulty is that (1) and (2) are contradictory goals, and since those conditions frequently occur together, cause conflict. When we fully scan a buffer this will result in 1 or more actual clog lookups, L. L is often less than the number of tuples on the page because of the single-item xid cache. If L = 1 then there is a high probability that when we do a seq scan the clog blocks will be cached also, so although we do a 1 clog lookup per table block we would seldom do clog I/O during a SeqScan. So what I tried to say in a previous post was that if L > 1 then we should dirty the buffer because the single-item cache becomes less-effective and we may need to access other clog blocks, that may result in clog I/O. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support