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