Solving the N+1 Problem in Rails

Solving the N+1 Problem in Rails

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.

Solving the N+1 Problem in Rails
Isabelle Samways
January 12, 2024