On Thursday, October 3, 2013 1:23:08 AM UTC-7, Edward J wrote: > Hi Jeremey! > > You're right, > allthough one behaviour which I think is a bit incorrect is that it seems > to do the slicing after fetching nested associations. for example > Article.eager(:recent_**comments => :user).limit(10).all > > the recent_comments association is limited to 5, but the query for > fetching the user for each comment has all comments returned from the first > query in it, not just the limited subset. >
I wouldn't consider this incorrect. The results don't differ from the expected results. It's true that it's the query is not as efficient, but due to implementation details it would difficult to do an efficient query. I'll certainly consider noninvasive patches, though I doubt that's possible. Considering that you still have to load all comments anyway to get the recent comments, trying to optimize the next level seems rather futile. If you want eager loading of limited associations to be efficient, use a database that supports window functions. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
