Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

AR::Relation's with eager loading cache_key's #1

Open
swalkinshaw opened this issue Feb 28, 2013 · 3 comments
Open

AR::Relation's with eager loading cache_key's #1

swalkinshaw opened this issue Feb 28, 2013 · 3 comments

Comments

@swalkinshaw
Copy link

Came across this gem from a Rails issue and had a similar problem I was going to solve. Thought it might be useful to include the solution in this gem as well.

We know that using includes to eager load associations is a good way to avoid N+1 queries. And obviously using fragment caching is good as well but they don't place nicely together. When fragment caching a relation that includes associations, they will all get loaded in the query to determine the cache key. In my opinion, the included associations should be discarded in this case.

If you're interested in this feature I could give it a go.

@cmer
Copy link
Owner

cmer commented Mar 1, 2013

Would like to see your implementation of this.

On 2013-02-28, at 3:23 PM, Scott Walkinshaw [email protected] wrote:

Came across this gem from a Rails issue and had a similar problem I was going to solve. Thought it might be useful to include the solution in this gem as well.

We know that using includes to eager load associations is a good way to avoid N+1 queries. And obviously using fragment caching is good as well but they don't place nicely together. When fragment caching a relation that includes associations, they will all get loaded in the query to determine the cache key. In my opinion, the included associations should be discarded in this case.

If you're interested in this feature I could give it a go.


Reply to this email directly or view it on GitHub.

@aaronchi
Copy link

+1

1 similar comment
@joaohornburg
Copy link

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants