David542
David542

Reputation: 110502

How do large sites do pagination?

How do large sites handle pagination on search results so that the nth page loads roughly as quickly as the first? For example, Google, Youtube, Hulu, etc.

Upvotes: 2

Views: 509

Answers (1)

Udi
Udi

Reputation: 30534

Youtube:

Sorry, YouTube does not serve more than 1000 results for any query

so it probably caches the first 1k results in a something similar to a memcached blob.

Hulu: limits to 3000 results. Probably cached as well.

Google: It's pure black magic. Keep in mind it uses a lot of distributed computing (and not a simple db lookup), and probably caches the first n results for any query, and also "html ready" results for each result page, and intermediate results (See Dynamic Programming).

To summarize: Your first query to any page might take more time since it can cause the engine to start a db/distributed search, however, it's results (much more than the amount you will be showed) will probably be kept for a while in a very fast cache for serving any page for the same query without stressing the db again.

Upvotes: 3

Related Questions