hoenth wrote:

> I am loading about 100 students. There is a single query to get them
> "select * from students...".
> 
> Then, it appears that it is doing an individual query for each
> student, to find that students homeroom, then another for that
> homeroom's classroom. It is not loading all of the classrooms in a
> single query, nor the homerooms. So for the 100 students, it does one
> query for student, 100 queries for homerooms, and 100 queries for
> classrooms (though some appear to be cached).
> 
> I thought it should only do 3 queries.

Can you post your ActiveRecord statement here?

And if the :through is not working, can you replace :include => :students with 
:include => { :classes => :students }? Tell the includer the actual lookup 
path, 
so it improves the odds of eagerness?

BTW if you use my inspect_sql system (gem install assert_efficient_sql), you 
can 
print out the exact statements, and you can assert their properties, such as 
their count.

-- 
   Phlip


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to