Re: How does PG know if data is in memory?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Richard Troy <rtroy(at)ScienceTools(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How does PG know if data is in memory?
Date: 2010-10-03 02:42:45
Message-ID: 4CA7EDA5.4080401@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 3/10/2010 7:39 AM, Richard Troy wrote:

> I can't speak for modern "OpenVMS", but "back in the day", VMS had a very
> effective memory management strategy which, in effect, made it as if all
> memory was a cache for disk. It did this by means of a mechanism by which
> to identify all potentially reachable disk space. When disk was read in,
> an entry would be made mapping the memory to the disk space from which it
> came - and if it was later updated, the mapping entry was marked "dirty."
> Whenever disk access was contemplated, a check was made to see if it was
> already in memory and if so, it'd provide access to the in-memory copy
> instead of doing the read again. (This also permitted, under some
> circumstances, to reduce write activity as well.)

That's how Linux's memory management works, too, at least if I
understand you correctly. Pretty much every modern OS does it. Pg is
reliant on the operating system's disk cache, and has some minimal
knowledge of it (see effective_cache_size) .

I don't know how shared_buffers management works, but certainly at the
OS cache level that's what already happens.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-10-03 21:39:54 Re: Wrong index choice
Previous Message Tom Lane 2010-10-02 00:16:21 Re: Issue for partitioning with extra check constriants