Does Datomic suffer from N+1 query problem?

For a nested data schema, we may want to optimize queries to reduce remote-query overheads. As far as I know, for Datomic, queries happens locally.

Let’s say we are implementing a GraphQL API, where the server does not have too much control over what to fetch or how deep do we need to fetch. Do we still need to optimize the queries to produce a nested pull pattern or it doesn’t matter if we let the GraphQL query engine recursively calls a shallow resolver.

Hi hden,

It depends. If you deploy your client application as an ion, then queries run in the same process as your application. It you call the client API from your own process, then queries are remote.

Have you looked at Lacinia? Maybe they have already built what you need.


Hi stu,

Thanks for replying. I’m running Lancia from an ion. To be specific, I’m wondering if I should use the nested selection API to optimize the nested pull pattern or should I return the :db/id and let Lancia recursively call the corresponding resolver.