Re: Readme of Buffer Management seems to have wrong sentence

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Readme of Buffer Management seems to have wrong sentence
Date: 2012-05-22 16:39:16
Message-ID: 2785.1337704756@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> If we're going to throw our current algorithm over wholesale, I'd
> rather use some approach that has been demonstrated to work well in
> other systems. Buffer eviction is a problem that's been around since
> the 1970s, and our algorithm is just about that old.

Um, if you're claiming that that code dates from Berkeley days, you're
quite mistaken. We adopted the clock sweep in 2005, after trying a few
other things whose performance was worse. I've not seen any argument in
this thread that suggests we should abandon clock sweep + usage counts
entirely. Rather, to me the issue is that we haven't completely gotten
rid of the last vestiges of the old global freelist approach.

BTW, it might be worth pointing out something I was trying to explain
to Amit at PGCon: the key reason that we went with usage counters rather
than something like a global LRU chain is that in the fast path where
ReadBuffer finds the requested block already in a buffer, it does not
have to contend for any global data structure to update the buffer's
usage information. It just has to bump the usage count in the buffer's
header. The free list, and the contention for BufFreelistLock, only
matter in the slow path where you're going to have to incur I/O anyway
(or at least a visit to the kernel). That seemed plenty good enough
in 2005. Our ambitions have now advanced further, so I'm on board with
trying to reduce contention here too, but I think it would be a mistake
to make the fast case any slower.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-05-22 16:42:53 Re: Exclusion Constraints on Arrays?
Previous Message Jeff Janes 2012-05-22 16:33:32 Re: Why is indexonlyscan so darned slow?