Cookbook recipe

Set effective_cache_size so the planner trusts the cache

Applies to PostgreSQL 13–17 Last reviewed May 2026 Grounded in source
Estimated investigation4 min

Scenario

The planner avoids index scans on data that is actually cached. effective_cache_size tells it how much memory the OS + PostgreSQL likely have for caching. Diagnose it Check the current value: SHOW effective_cache_size; Why it happens…

Investigation Path

The planner avoids index scans on data that is actually cached. effective_cache_size tells it how much memory the OS + PostgreSQL likely have for caching.

Diagnose it

Check the current value:

SHOW effective_cache_size;

Why it happens

effective_cache_size does not allocate memory; it is a planner hint. Set too low, the planner assumes index pages will miss cache and over-prefers sequential scans. Set realistically, it favors index scans that pay off because pages are warm.

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • How to fix it
  • Prevent it next time
  • Related & next steps
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Career Impact

This scenario builds production judgment and operational confidence under pressure.

Open Career Dashboard →

Keep going

Related & next steps

Was this helpful?

← All cookbook recipes