azuline / repertoire

whoops never finished this lol, don't look it's old and embarrassing

Home Page:https://repertoire.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.