educative.io

Sharding based on Tweet creation time

“Storing tweets based on creation time will give us the advantage of fetching all the top tweets quickly and we only have to query a very small set of servers.”

I don’t understand why we can fetch top tweets quickly and only query a very small set of servers.

Because the we still have to go through the steps below

  1. Our application (app) server will find all the people the user follows.
  2. App server will send the query to all database servers to find tweets from these people.
  3. Each database server will find the tweets for each user, sort them by recency and return the top tweets.
  4. App server will merge all the results and sort them again to return the top results to the user.

Only benefit I can see is reducing the sort time.

Does anyone can help me understand it?