tunning disk cache for pgsql?

Jim Nasby jim at nasby.net
Fri Dec 31 00:32:06 UTC 2010

On Dec 28, 2010, at 7:59 AM, Nicolas Haller wrote:
> I use a new box with 4GB RAM as a pgsql server. In pgsql, you can
> set the effective_cache_size to indicate the memory available to cache
> disk I/O.
> As "recommended", my box use 1300MB to shared buffers (IPC shared memory)
> and 2700 Mo to disk cache.

That's probably not a great mix unless your workload is very read-heavy. Writes will push data through shared buffers back into the OS, which will also try to cache it, so you'll end up with double-buffering.

> If I look memory usage in top, it say:
> Mem: 1154M Active, 1911M Inact, 601M Wired, 112M Cache, 417M Buf, 148M Free

The Cache reported by top in FreeBSD isn't filesystem cache; it's a cache for some internal stuff. Buf are filesystem buffers, but they're not the only mechanism for the OS to cache data. Most data is actually cached via active and inactive pages.
Jim C. Nasby, Database Architect                   jim at nasby.net
512.569.9461 (cell)                         http://jim.nasby.net

More information about the freebsd-performance mailing list