▲ | richardlblair 5 days ago | ||||||||||||||||
If your ORM is going to the DB per row you're using it wrong. N+1 queries are a performance killer. They are easy to spot in any modern APM. Rails makes this easy to avoid. Using `find_each` batches the queries (by 1,000 records at a time by default). Reading through the comment section on this has been interesting. Either lots of people using half baked ORMs, people who have little experience with an ORM, or both. | |||||||||||||||||
▲ | wild_egg 5 days ago | parent [-] | ||||||||||||||||
I mean Rails also makes it easy to accidentally nest further queries inside your `find_each` block and end up with the same problem. Your team can have rules and patterns in place to mitigate it but I'd never say "Rails makes this easy to avoid". | |||||||||||||||||
|