Rails scales well? Well, we can look at Github which, yes, scales very well. But how do they do it? How do you solve an N+1 problem so that it doesn't affect the performance of database queries?In this post, we'll start by explaining what the N+1 problem is. Then, we'll see how we can solve it with pure SQL and, finally, how we implement the solution in Rails.