effective_cache_size
The planner's estimate of how much memory is available for caching data, shared buffers plus the OS cache.
- デフォルト
4GB- Range
- 8kB upward, in 8kB pages
- Restart needed
- いいえ
- Default checked on
- PostgreSQL 18
何ができるか
Allocates nothing. The planner uses it to judge whether repeated index lookups will hit cache, so a higher value makes index scans look cheaper relative to sequential scans.
デフォルト値
4GB. 4GB (PostgreSQL 18), unchanged since 9.4.
Check the current value
SHOW effective_cache_size; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'effective_cache_size';
Change it
SET effective_cache_size = '24GB'; -- this session ALTER ROLE reporting SET effective_cache_size = '24GB'; -- new sessions of one role ALTER SYSTEM SET effective_cache_size = '24GB'; SELECT pg_reload_conf();
No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When to change it
Set it to about 50-75% of RAM on a dedicated database server. It is safe to set per session for experiments.
What can go wrong
Set far too high, the planner picks index scans that thrash disk once the data is not actually cached; far too low, it avoids indexes that would have been fast.
Questions about effective_cache_size
What is the default value of effective_cache_size in PostgreSQL?
4GB. 4GB (PostgreSQL 18), unchanged since 9.4.
Does changing effective_cache_size require a restart?
No. No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When should I change effective_cache_size?
Set it to about 50-75% of RAM on a dedicated database server. It is safe to set per session for experiments.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check effective_cache_size on your own server
SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.