Re: PostgreSQL caching - Mailing list pgsql-performance

From Neil Conway
Subject Re: PostgreSQL caching
Date
Msg-id 40AE5248.8090807@samurai.com
Whole thread Raw
In response to Re: PostgreSQL caching  ("Rosser Schwarz" <rschwarz@totalcardinc.com>)
List pgsql-performance
Rosser Schwarz wrote:
> PostgreSQL uses the operating system's disk cache.

... in addition to its own buffer cache, which is stored in shared
memory. You're correct though, in that the best practice is to keep the
PostgreSQL cache small and give more memory to the operating system's
disk cache.

> Pgsql uses the OS's disk cache instead of its own cache management
> because the former is more likely to persist.  If the postmaster
> managed the cache, as soon as the last connection died, the memory
> allocated for caching would be released, and all the cached data
> would be lost.

No; the cache is stored in shared memory. It wouldn't persist over
postmaster restarts (without some scheme of saving and restoring it),
but that has nothing to do with why the OS disk cache is usually kept
larger than the PG shared buffer cache.

-Neil


pgsql-performance by date:

Previous
From: Bill Montgomery
Date:
Subject: Avoiding vacuum full on an UPDATE-heavy table
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: Avoiding vacuum full on an UPDATE-heavy table