Bird
0
0

What is the primary purpose of tuning work_mem in PostgreSQL?

easy📝 Conceptual Q1 of 15
PostgreSQL - Performance Tuning
What is the primary purpose of tuning work_mem in PostgreSQL?
ATo set the maximum size of the shared buffer cache
BTo control the amount of memory used for internal sort operations and hash tables before writing to disk
CTo limit the total memory used by all connections combined
DTo define the maximum size of the WAL (Write-Ahead Log) files
Step-by-Step Solution
Solution:
  1. Step 1: Understand work_mem role

    work_mem controls memory for sorts and hash operations per query before spilling to disk.
  2. Step 2: Differentiate from other memory settings

    It does not control shared buffers or WAL size, which are separate settings.
  3. Final Answer:

    To control the amount of memory used for internal sort operations and hash tables before writing to disk -> Option B
  4. Quick Check:

    work_mem = memory per sort/hash [OK]
Quick Trick: work_mem is per operation memory, not total server memory [OK]
Common Mistakes:
  • Confusing work_mem with shared_buffers
  • Thinking work_mem limits total server memory
  • Mixing work_mem with WAL settings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes