Bird
0
0

After adding several indexes to a PostgreSQL table, a developer observes that UPDATE statements are running slower than before. What is the most probable cause?

medium📝 Debug Q7 of 15
PostgreSQL - Indexing Strategies
After adding several indexes to a PostgreSQL table, a developer observes that UPDATE statements are running slower than before. What is the most probable cause?
AIndexes cause deadlocks that delay UPDATE queries
BPostgreSQL automatically disables indexes during UPDATE operations
CThe table's data pages become fragmented, causing slower disk reads
DEach UPDATE must also modify all related indexes, increasing overhead
Step-by-Step Solution
Solution:
  1. Step 1: Understand how indexes affect write operations

    Indexes must be updated whenever the indexed columns are modified, adding overhead.
  2. Step 2: Analyze the impact on UPDATE statements

    Since UPDATE changes data, all indexes on affected columns need maintenance, slowing down the operation.
  3. Final Answer:

    Each UPDATE must also modify all related indexes, increasing overhead -> Option D
  4. Quick Check:

    Indexes speed reads but slow writes due to maintenance [OK]
Quick Trick: More indexes mean slower writes due to update overhead [OK]
Common Mistakes:
  • Thinking indexes are disabled during updates
  • Assuming fragmentation is the main cause
  • Believing indexes cause deadlocks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes