Solving the N+1 query problem
Subpart of #4362 One of the usual suspects of slow performance are N+1 queries. A single line of code may make far too many independent database queries resulting in slow performance.The possible solution for this is using eager loading wherever possible. But to identify all the places where we could use eager loading is not feasible manually. Therefore one solution to this can be using the 'Bullet' gem. This gem will watch our queries while we develop our application and notify us when we should add eager loading (N+1 queries), when we use eager loading that is not necessary—and when we should use counter caching.
This is where bullet can be found https://github.com/flyerhzm/bullet . Bullet offers various types of alerts regarding N+1 queries such as javascript alerts, entry to log file bullet.log etc. @jywarren if you think that this would be useful for us, then I can make a PR for this immediately. This gem would be added in the development mode and we will monitor the log file regularly to see which queries are causing problems and resolve them accordingly. Thank you!