System Design · Middle · Question 44 of 75

Why can returning totalCount in every list response be expensive?

Explanation

An infinite feed doesn't need an exact number - hasNextPage is enough. If the number matters, use an approximate estimate, cache the count, or compute it separately and less often.

Further reading

Problem with a question

System Design · Middle · question 44

Test yourself

Take the System Design · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz