Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-24 Thread Sean Patrick Hogan
Thanks for the input! So, I'm assuming by "easiest case" you mean just calling LEFT OUTER JOINs. That's Rails behavior and then it deals with it in Ruby. I'm not too familiar with SQLAlchemy, but it looks like that's what they're doing in their EagerLoader as well. The only way I can think of o

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Sean Patrick Hogan
It isn't *an* extra SQL query that I'm worried about. It's that it's going to be about 2,000 extra SQL queries in a loop. If it were just constructing a page with one item and then its related items, that's not a problem to do two queries, but when you're looping over 2,000 items and running an