On 2013-04-02 18:26:23 +0100, Greg Stark wrote: > I'm confused by this thread. We *used* to maintain an LRU. The whole > reason for the clock-sweep algorithm is precisely to avoid maintaining > a linked list of least recently used buffers since the head of that > list is a point of contention.
I don't think anybody is proposing to put the LRU back into a linked list, given the frequency of usagecount manipulations that would probably end pretty badly. What I think Robert, Tom and I are talking are talking about is putting *some* buffers with usagecount = 0 into a linked list so that when a backend requires a new page it can take one buffer from the freelist instead of a) possibly touching quite some (I have seen 4 times *every* existing header) pages to find one with usagecount = 0 b) having to write the page out itself If everything is going well that would mean only the bgwritter (or if bgfreelist or whatever) performs the clock sweep. Others take *new* pages from the freelist instead of performing part of the sweep themselves. Makes more sense? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers