|
|
|
|
|
by libria
96 days ago
|
|
You're not the only one. I never stopped to delve into what this N+1 problem was b/c I assumed it was never an issue for me. All these years and this is the 1st time I've finally understood what they were saying. However, after going back and forth with LLM on it just now, I feel like "1+N" is just a coding mistake, not a perplexing multi-faceted, engineering problem to be solved. Experience or a slow application would teach you to find a better way to get that info and then you move on. |
|
In languages with strong meta-programming, like Ruby, it is possible to deal with N+1s more automatically, which allows you to prevent them systematically, and most importantly have an elegant solution to N+1s that span independent blocks of code.
A couple of articles about these techniques: https://www.aha.io/engineering/articles/90-percent-of-rails-... https://www.aha.io/engineering/articles/automatically-avoidi...