4 ms·
How does json_agg solve the n+1 problem?
by advance512 6y ago
How does json_agg solve the n+1 problem?
- tehlike 6y agoIt can eagerload more complex queries. If you are eagerloading multiple joins relationships, normally that would create a result set of n x m x k x ... rows. With json_agg each relation could be single column in a row etc.
- dmitrytsepelev 6y agoIn this case the row size can become huge. Also, how to make sure it's consistent? (I mean foreign keys/unique indexes/etc)
- tehlike 6y agoi was mostly talking about reading side, not mutation side.