Robert Haas <robertmh...@gmail.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers