Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count the amount of queries in Rails

I'm trying to optimize my site, in order to do that I want to know which action is making more queries than others. Is there anyway to know the amount of DB hits made by one action?

like image 684
joeloui Avatar asked Feb 16 '12 21:02

joeloui


2 Answers

i found these gem very helpful for inspecting issues and optimizing queries

  • https://github.com/noahd1/oink
  • https://github.com/flyerhzm/bullet
like image 101
Naveed Avatar answered Oct 06 '22 01:10

Naveed


This gem will do exactly what you need: show the number of db queries issued per action:

https://github.com/makandra/query_diet

like image 45
Juan Alonso Avatar answered Oct 06 '22 00:10

Juan Alonso