|
|
|
|
|
by mvdtnz
845 days ago
|
|
I'm very familiar with Linq and Linq to SQL. It's as close as any ORM got to being "good enough" and was abandoned by Microsoft very early in its lifecycle. Linq in Entity Framework is a minefield of N+1's and excessive eager loading. |
|
1. keeping a log of queries per request with stack traces
2. at the end, checking if there are N+1 problems
3. print a big warning with example SQL and stack trace to the console
During dev if I miss a prefetch_related/select_related the console will start to print gigantic stack traces telling me where the problem is. I don't have these problems in production because I get alerted to them in dev.
These are not only solvable problems but EASILY solvable problems!
(Also, in iommi tables, most of the times it can automatically figure out and do the prefetch/select related for you, further diminishing the problem)