Hacker News new | ask | show | jobs
by stevoski 292 days ago
Something missing from the article:

For the type of cache usage described in the article, cache lookups are almost always O(1). This is because a cache value is retrieved for a specific key.

Whereas db queries are often more complicated and therefore take longer. Yes, plenty of db queries are fetching a row by a key, and therefore fast. But many queries use a join and a somewhat complicated WHERE clause.