Re: Clock sweep not caching enough B-Tree leaf pages?

From: Greg Stark <stark(at)mit(dot)edu>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?
Date: 2014-04-18 15:46:08
Message-ID: CAM-w4HPbAhwPTG5FYGCApCuDfv6feEnup4C0sjrCErXbGv_1dQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 18, 2014 at 4:14 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> I am a bit confused by this remark. In *any* circumstance when you
> evict you're incurring precisely one page fault I/O when the page is
> read back in. That doesn't mean that the choice of which page to
> evict is irrelevant.

But you might be evicting a page that will be needed soon or one that
won't be needed for a while. If it's not needed for a while you might
be able to avoid many page evictions by caching a page that will be
used several times.

If all the pages currently in RAM are hot -- meaning they're hot
enough that they'll be needed again before the page you're reading in
-- then they're all equally bad to evict.

I'm trying to push us away from the gut instinct that frequently used
pages are important to cache and towards actually counting how many
i/os we're saving. In the extreme it's possible to simulate any cache
algorithm on a recorded list of page requests and count how many page
misses it generates to compare it with an optimal cache algorithm.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-04-18 16:42:58 Re: assertion failure 9.3.4
Previous Message Alvaro Herrera 2014-04-18 15:15:34 Re: How can we make beta testing better?