N+1 problem
azuline opened this issue · comments
Solving the N+1 problem would be a fun exercise, although I don't think the performance improvements are necessary or a priority.
Solution I had in mind:
- Move the 'related' functions of models to dataclass properties (cached).
- Add
preload_{related}
keyword flags to the fetch functions.- Preload / batch load the selected models.
https://sqlite.org/np1queryprob.html so this isn't a problem with SQLite... so let's just not deal with this problem.