29 Jun 2015
TLDR, eager_group fixes n+1 aggregate sql functions for rails.
After consulting on some rails projects, I find most projects are still suffering from N+1 query problem. Many rails developers aren't aware that they generate hundreds sqls in one request, it's horrible.
What's n+1 query problem?
It occurs when you fetch n records from database and send additional sql for each record, let me give you an example, we have Post and Comment models and one Post has many Comments.
class Post < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord:Base bel...