Re: How does PG know if data is in memory? - Mailing list pgsql-performance

From Craig Ringer
Subject Re: How does PG know if data is in memory?
Date
Msg-id 4CA7EDA5.4080401@postnewspapers.com.au
Whole thread Raw
In response to How does PG know if data is in memory?  (Fabrício dos Anjos Silva<fabricio.silva@linkcom.com.br>)
List 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/

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Issue for partitioning with extra check constriants
Next
From: Tom Lane
Date:
Subject: Re: Wrong index choice