Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

AR::Base.find_every should support :preload => false option

#2820

When doing an :include, the preload_associations method of pulling the included object takes significantly longer as data sizes go up - it went from 35 percent slower to 45 percent slower to 55 percent slower as I doubled the dataset size.

Could you please add an option to force the include to use find_with_associations instead of preload_associations? Right now we include a condition that uses the joined table that we know is always true that forces it - but this is not our preferred solution.

So find_every would end up being something like this

 if include_associations.any? && (references_eager_loaded_tables?(options) || options[:include_join])

Reported by ransom-briggs (at uiowa) · June 19th, 2009 @ 10:53 PM

State: hold
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Elliot Winkler
    Elliot Winkler
    • Title changed from Feature Request - add association option for find_with_associations to AR::Base.find_every should support :preload => false option

    I've been wanting this too, and so I made a patch for it (pass :preload => false to disable preloading for a specific query). A test is included, but I wasn't quite sure where it should go (looking through all those tests gives me a headache), or even if the one is enough. But it made sense to me, at least.

    June 28th, 2009 @ 09:47 AM

  2. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from eager_loading, find_with_associations, include, preload_associations to bugmash, eager_loading, find_with_associations, include, preload_associations

    August 7th, 2009 @ 02:15 PM

  3. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to hold
    • Tag changed from bugmash, eager_loading, find_with_associations, include, preload_associations to arel, preload

    Keeping this on hold till Emilio's arel branch is merged in. We had a discussion in the core ML about this a while ago - http://groups.google.com/group/rubyonrails-core/browse_thread/threa...

    Please do chime in there if you have any more thoughts/suggestions.

    Thanks!

    August 8th, 2009 @ 01:43 AM