SLRU

Started by Soroosh Sardariover 12 years ago2 messages
#1Soroosh Sardari
soroosh.sardari@gmail.com

Hey

I was reading the multi transaction log manager, multixact.c.
I didn't get what SLRU does.

I want the goal of this module, and why we use it.
I'm kind of newbie, be patient with me ;)

Regards
Soroosh

#2Pavan Deolasee
pavan.deolasee@gmail.com
In reply to: Soroosh Sardari (#1)
Re: SLRU

On Mon, Jun 17, 2013 at 1:22 PM, Soroosh Sardari
<soroosh.sardari@gmail.com>wrote:

Hey

I was reading the multi transaction log manager, multixact.c.
I didn't get what SLRU does.

I want the goal of this module, and why we use it.
I'm kind of newbie, be patient with me ;)

Did you look at src/backend/access/transam/slru.c ? The first para in that
file is quite explanatory:

* We use a simple least-recently-used scheme to manage a pool of page
* buffers. Under ordinary circumstances we expect that write
* traffic will occur mostly to the latest page (and to the just-prior
* page, soon after a page transition). Read traffic will probably touch
* a larger span of pages, but in any case a fairly small number of page
* buffers should be sufficient. So, we just search the buffers using plain
* linear search; there's no need for a hashtable or anything fancy.
* The management algorithm is straight LRU except that we will never swap
* out the latest page (since we know it's going to be hit again
eventually).

Thanks,
Pavan

--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee