nplusone is a library that is supposed to help finding inefficient DB queries. I spent some time to try it. My conclusion is that is not all that helpful. I like the general approach. However, it generates many false positives and it's hard to see what would have to be changed to fix the warnings. Also, fixing all warnings would be premature optimization.