I was trying to work out why a page on my site was so slow. The
queries themselves seemed to be executing pretty quickly so I tried
playing around to see if Rails was causing the overhead.

I changed the line:
      records = Record.order(:col).joins(:table1)
to:
      records = Record.order(:col).joins('INNER JOIN "table1" ON
"table1"."table2_id" = "table2"."id"')

...and this shaved 100s of ms off the page render time.

Can anyone else try this and confirm it?

Shim
><>

-- 
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 [email protected].
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