Re: Page replacement algorithm in buffer cache - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Page replacement algorithm in buffer cache
Date
Msg-id 487.1364069262@sss.pgh.pa.us
Whole thread Raw
In response to Re: Page replacement algorithm in buffer cache  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
Jeff Janes <jeff.janes@gmail.com> writes:
> I'm more convinced in the other direction, new pages should enter with 0
> rather than with 1.  I think that the argument that a new buffer needs to
> be given more of an opportunity to get used again is mostly bogus.

IIRC, the argument for starting at 1 not 0 is that otherwise a new page
might have an infinitesmally small lifespan, if the clock sweep should
reach it just after it gets entered into the buffers.  By starting at
1, the uncertainty in a new page's lifespan runs from 1 to 2 sweep times
not 0 to 1 sweep time.

I think though that this argument only holds water if the buffer didn't
get found via the clock sweep to start with --- otherwise, it ought to
have just about one clock sweep of time before the sweep comes back to
it.  It does apply to buffers coming off the freelist, though.

Thus, if we were to get rid of the freelist then maybe we could change
the starting usage_count ... but whether that's a good idea in itself
is pretty uncertain.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Page replacement algorithm in buffer cache
Next
From: Jeff Janes
Date:
Subject: Re: Page replacement algorithm in buffer cache