This project is archived and is in readonly mode.

#2820 ✓hold
ransom-briggs (at uiowa)

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

Reported by ransom-briggs (at uiowa) | June 19th, 2009 @ 10:53 PM | in 2.x

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])

Comments and changes to this ticket

  • Elliot Winkler

    Elliot Winkler June 28th, 2009 @ 09:47 AM

    • 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.

  • CancelProfileIsBroken

    CancelProfileIsBroken August 7th, 2009 @ 02:15 PM

    • Tag changed from eager_loading, find_with_associations, include, preload_associations to bugmash, eager_loading, find_with_associations, include, preload_associations
  • Pratik

    Pratik August 8th, 2009 @ 01:43 AM

    • 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!

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Tags

Pages