Bird
0
0

You see this EXPLAIN output:

medium📝 Debug Q7 of 15
PostgreSQL - Performance Tuning
You see this EXPLAIN output:
Nested Loop  (cost=0.00..37.50 rows=5 width=200)

But the query runs very slowly. What could be a reason?
AThe query uses a sequential scan on a small table
BThe query is missing a GROUP BY clause
CThe EXPLAIN output is incorrect
DThe Nested Loop is joining large tables without indexes
Step-by-Step Solution
Solution:
  1. Step 1: Understand Nested Loop behavior

    Nested Loops can be slow if joining large tables without indexes.
  2. Step 2: Evaluate other options

    GROUP BY absence or small table scans don't explain slowness here.
  3. Final Answer:

    The Nested Loop is joining large tables without indexes -> Option D
  4. Quick Check:

    Slow Nested Loop = Large join without indexes [OK]
Quick Trick: Nested Loops slow on large joins without indexes [OK]
Common Mistakes:
  • Blaming missing GROUP BY for slowness
  • Assuming EXPLAIN output is wrong
  • Ignoring join method impact on speed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes