Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJUjJ-0002Uz-2T for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Mar 2013 20:07:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UJUjI-00016r-1y for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Mar 2013 20:07:52 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJUjG-00016l-Nz for pgsql-hackers@postgresql.org; Sat, 23 Mar 2013 20:07:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJUjA-00052l-C9 for pgsql-hackers@postgresql.org; Sat, 23 Mar 2013 20:07:50 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r2NK7ggW000488; Sat, 23 Mar 2013 16:07:42 -0400 (EDT) From: Tom Lane To: Jeff Janes cc: Atri Sharma , Pg Hackers Subject: Re: Page replacement algorithm in buffer cache In-reply-to: References: Comments: In-reply-to Jeff Janes message dated "Sat, 23 Mar 2013 12:29:24 -0700" Date: Sat, 23 Mar 2013 16:07:42 -0400 Message-ID: <487.1364069262@sss.pgh.pa.us> X-Pg-Spam-Score: -4.4 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Jeff Janes 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers