All Questions
Dynamodb hard

To model 'Followers/Following' relationships in a social app, an engineer uses a GSI with 'Inverted Keys' (Adjacency List). Why is this more efficient than using a JSON array of UserIDs?

  1. A It allows the application to use the `JOIN` command in the SDK.
  2. B Infinite Scalability: A JSON array is limited by the 400KB item limit (approx 10,000 IDs). An Adjacency List stores each relationship as a separate item, allowing a user to have millions of followers that can be paginated and queried efficiently via the GSI.
  3. C It reduces the write cost because indexes are updated in a background low-priority queue.
  4. D JSON arrays in DynamoDB are not searchable via Query.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions