3 ms·
I'm really interested to know how server side API's internally handle overreaching problems and performance. Client side developers in my current workplace alw
by emilsedgh 9y ago
I'm really interested to know how server side API's internally handle overreaching problems and performance.
Client side developers in my current workplace always ask for huge nested objects. We're having a tough time regarding performance as responses are sometimes 6-7 levels of nested objects.
That means a ton of database queries. How does everybody else manage this?
- denimnerd 9y agoyou need to denormalize your database so you can just query for those particular objects without a bunch of joins. Put a limit on nesting, but honestly 6-7 levels doesn't sound that bad.
- cel1ne 9y ago`jsonb` functions in Postgresql can build nested objects in a single select statement. Combine that with proper joins and functional indices and there shouldn't be a problem.
- aaronblohowiak 9y agoWhy is it more than 7 queries?
- emilsedgh 9y agoIf its a collection of 100 items it would be 700 queries.
- chao- 9y agoWouldn't it only be 7? First query gets the first 100 items, the second query gets the nested associations for those 100 (assuming you couldn't batch it into the first query), the third gets the nested associations for the second's, and so forth. One query for each entity category?
- deleted 9y ago[deleted]