Skip to content

Instantly share code, notes, and snippets.

@razorcd
Created March 2, 2015 20:19
Show Gist options
  • Save razorcd/987302fa0e9681df7c72 to your computer and use it in GitHub Desktop.
Save razorcd/987302fa0e9681df7c72 to your computer and use it in GitHub Desktop.
Banchmark SQL
bm = ->(counter=1) {
Benchmark.measure do
counter.times do |i|
Sponsorship.joins(:sponsor, :orphan).
where("sponsor_id = ?",1).
select("orphans.name as orphans_name, orphans.date_of_birth as orphans_date_of_birth, orphans.gender as orphans_gender").
to_a
# puts i
end
end
}
bm.call(1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment