Benito Serna Tips and tools for Ruby on Rails developers

PDF with the benchmarks for the fixes to the latest-comment n+1 problem

November 19, 2020

When you are trying to solve an n+1 problem, hopefully you will find different ways to solve it. But what is the one that you should use?

Talking specifically about the fixes that I share to you to solve the “latest comment” n+1 queries problem… I think you can use the first one, “the association with default order”, unless your metrics are telling you that you need something different.

But any way, I think that been aware of the performance implications of your code and understanding the tradeoffs is a good thing

That’s why I want to share with you some benchmarks to the 5 fixes in different scenarios, to help you understand which solution is better in each case, and which solution would be enough for your case.

I have already shared the benchmarks for this 5 fixes on html format.

But now I put the report also on PDF =)

Related articles