Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

So it's a classic N+1 query?


It's more like (in good old RDBMS world) 'SELECT * FROM payments' and calculate sum on client vs 'SELECT SUM(amount) FROM payments WHERE some_id = ?'

though they already had this sum precalculated


That would be more forgivable. This is:

  SELECT * FROM payments where paymentID = 1
  SELECT * FROM payments where paymentID = 2
  SELECT * FROM payments where paymentID = 3
  ...
  SELECT * FROM payments where paymentID = 14986
Each of those in its own API request over the wire, then sum them on the client.


Not really. N+1 is about « to many » relationships. You would need at least 2 collections to run into that problem.

In sql equivalent, what happened would be more like doing a full table scan on each query instead of using an index ( and not even that, because pre-computing a total isn’t really like an index)

This kind of « account balance » problems are typical of the problems where transactions are really useful. But also historically the kind of problem where nosql techs do a poor job ( they’re more built with « eventual consistency » in mind than atomic or transactional behaviors)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: