Bird
0
0

Given work_mem = '4MB' and a query performing 5 simultaneous sorts, what is the maximum total memory PostgreSQL might use for these sorts?

medium📝 query result Q4 of 15
PostgreSQL - Performance Tuning
Given work_mem = '4MB' and a query performing 5 simultaneous sorts, what is the maximum total memory PostgreSQL might use for these sorts?
A4MB
B5MB
C20MB
D9MB
Step-by-Step Solution
Solution:
  1. Step 1: Calculate total memory for sorts

    Each sort can use up to 4MB, so 5 sorts use 5 x 4MB = 20MB.
  2. Step 2: Confirm no shared memory pooling

    Memory is allocated per operation, so total is sum of all.
  3. Final Answer:

    20MB -> Option C
  4. Quick Check:

    Total memory = work_mem x number of sorts [OK]
Quick Trick: Multiply work_mem by number of simultaneous operations [OK]
Common Mistakes:
  • Assuming work_mem is total for all sorts
  • Adding 1MB instead of multiplying
  • Confusing work_mem with effective_cache_size

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes