effective_cache_size
As mentioned in the last chapter, PostgreSQL is expected to have both its own dedicated memory (shared_buffers
) as well as utilize the filesystem cache. In some cases, when making decisions like whether it is efficient to use an index or not, the database compares sizes it computes against the effective sum of all these caches; that's what it expects to find in effective_cache_size
.
The same rough rule of thumb that would put shared_buffers
at 25 percent of system memory would set effective_cache_size
to between 50 and 75 percent of RAM. To get a more accurate estimate, first observe the size of the filesystem cache:
- UNIX-like systems: Add the
free
andcached
numbers shown by thefree
ortop
commands to estimate the filesystem cache size - Windows: Use the Windows Task Manager's Performance tab and look at the
System Cache
size
Assuming you have already started the database, you need to then add the shared_buffers
figure to this value to arrive at a figure...