On Wed, Jan 20, 2016 at 9:02 AM, Andres Freund <and...@anarazel.de> wrote: > Chatting on IM with Heikki, I noticed that we're pretty pessimistic in > SetHintBits(). Namely we don't set the bit if XLogNeedsFlush(commitLSN), > because we can't easily set the LSN. But, it's actually fairly common > that the pages LSN is already newer than the commitLSN - in which case > we, afaics, just can go ahead and set the hint bit, no? > > So, instead of > if (XLogNeedsFlush(commitLSN) && BufferIsPermanent(buffer) > return; /* not flushed yet, > so don't set hint */ > we do > if (BufferIsPermanent(buffer) && XLogNeedsFlush(commitLSN) > && BufferGetLSNAtomic(buffer) < commitLSN) > return; /* not flushed yet, > so don't set hint */ > > In my tests with pgbench -s 100, 2GB of shared buffers, that's recovers > a large portion of the hint writes that we currently skip.
Dang. That's a really good idea. Although I think you'd probably better revise the comment, since it will otherwise be false. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers