Open kapone89 opened 4 years ago
When we preload an association, methods like .empty? or .size still produce a query
.empty?
.size
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
fast_jsonapi
user = User.all.with_associations(:posts).first user.posts # <- no query user.posts.size # <- query user.posts.empty? # <- query
Neo4j database version: 3.5.12 neo4j gem version: 9.6.2 neo4j-core gem version: 9.0.0
neo4j
neo4j-core
@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?
When we preload an association, methods like
.empty?
or.size
still produce a queryIt 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#L130Code example (inline, gist, or repo)
Runtime information:
Neo4j database version: 3.5.12
neo4j
gem version: 9.6.2neo4j-core
gem version: 9.0.0