Bird
0
0

A query using Merge Join runs very slowly. Which of these is a likely cause?

medium📝 Debug Q7 of 15
PostgreSQL - Performance Tuning
A query using Merge Join runs very slowly. Which of these is a likely cause?
ATables have too many indexes
BHash Join is disabled
CNested Loop Join is forced
DInput tables are not sorted on join keys
Step-by-Step Solution
Solution:
  1. Step 1: Check Merge Join requirements

    Merge Join requires sorted inputs; unsorted tables cause slow performance.
  2. Step 2: Review other options

    Disabling Hash Join or forcing Nested Loop does not explain slow Merge Join; indexes do not slow Merge Join directly.
  3. Final Answer:

    Input tables are not sorted on join keys -> Option D
  4. Quick Check:

    Merge Join slow = unsorted inputs [OK]
Quick Trick: Merge Join needs sorted inputs for speed [OK]
Common Mistakes:
  • Blaming disabled Hash Join for Merge Join slowness
  • Assuming indexes slow Merge Join
  • Confusing forced Nested Loop with Merge Join speed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes