Bird
0
0

A developer tries to horizontally decompose a user table by user ID but notices some queries fail due to missing data. What is the likely cause?

medium📝 Analysis Q6 of 15
Microservices - Migration from Monolith
A developer tries to horizontally decompose a user table by user ID but notices some queries fail due to missing data. What is the likely cause?
AThe user ID is not unique
BData needed by queries is spread across multiple shards causing incomplete results
CThe database schema was not normalized
DVertical decomposition was applied instead of horizontal
Step-by-Step Solution
Solution:
  1. Step 1: Understand horizontal decomposition by user ID

    Data is split by user ID across shards.
  2. Step 2: Analyze query failure cause

    Queries needing data from multiple shards may fail if not designed to aggregate results.
  3. Final Answer:

    Data needed by queries is spread across multiple shards causing incomplete results -> Option B
  4. Quick Check:

    Horizontal split -> queries need cross-shard aggregation [OK]
Quick Trick: Cross-shard queries need aggregation to avoid missing data [OK]
Common Mistakes:
  • Confusing vertical and horizontal decomposition
  • Blaming schema normalization
  • Assuming user ID uniqueness solves query issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes