You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
This code is called to eager-load an associated resource. It has bizarre performance characteristics, so that a collection with 2 resources may be more efficient to work with than a collection with 1 resource.
Example:
We have two resources. Call them Thing and ThingClaim. A thing has 1, :thing_claim. We have an index route. It does something like
If Thing.all returns 2 or more objects, this ends up issuing 2 queries (load all things, load all thing claims.) If Thing.all returns exactly 1 object, this code ends up issuing 5 queries (one to load things, one to load the claim and get the create time, one to load the claim and get the expire time...) because the claim is not stored.
This is freakish, bizarre, and unexpected. I propose that this comparison be changed to > 0.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
At https://github.com/datamapper/dm-core/blob/master/lib/dm-core/associations/one_to_many.rb#L94
This code is called to eager-load an associated resource. It has bizarre performance characteristics, so that a collection with 2 resources may be more efficient to work with than a collection with 1 resource.
Example:
We have two resources. Call them Thing and ThingClaim. A thing
has 1, :thing_claim
. We have an index route. It does something likeIf
Thing.all
returns 2 or more objects, this ends up issuing 2 queries (load all things, load all thing claims.) IfThing.all
returns exactly 1 object, this code ends up issuing 5 queries (one to load things, one to load the claim and get the create time, one to load the claim and get the expire time...) because the claim is not stored.This is freakish, bizarre, and unexpected. I propose that this comparison be changed to
> 0
.The text was updated successfully, but these errors were encountered: