activegraph
activegraph copied to clipboard
Methods like .empty? or .size doesn't work well with eager loading
When we preload an association, methods like .empty?
or .size
still produce a query
It cause an N+1 queries issues when we use this gem together with fast_jsonapi
gem.
See this: https://github.com/Netflix/fast_jsonapi/blob/master/lib/fast_jsonapi/serialization_core.rb#L130
Code example (inline, gist, or repo)
user = User.all.with_associations(:posts).first
user.posts # <- no query
user.posts.size # <- query
user.posts.empty? # <- query
Runtime information:
Neo4j database version: 3.5.12
neo4j
gem version: 9.6.2
neo4j-core
gem version: 9.0.0
@kapone89 is there any progress on this issue?
@Muhammad-Abdullah-11 I don't know. I'm not in the project using neo4j anymore. It was long time ago 😄 @polecpiotr maybe you can check if it's still valid?