Concept Flow - Work_mem and effective_cache_size tuning
Start Query Execution
Check work_mem setting
Sort/Hash operations use work_mem
If work_mem too low -> Disk spill
Check effective_cache_size
Planner estimates cached data
Choose query plan based on cache estimate
Execute query with chosen plan
End Query Execution
The database uses work_mem for sorting and hashing during query execution. It uses effective_cache_size to estimate how much data is cached in memory to choose the best query plan.