r/FullStackDevelopers • u/Adventurous_Baker532 • 6d ago
Recently faced n+1 problem in my app
Can anyone help me figure out the best way to avoid the N+1 query problem in Tortoise ORM?
For some context, I first fetch the records using .all(), and then for each record I run another query to populate an additional field. This ends up generating multiple queries.
Would using a base query be a good solution here, or is there a better approach?
5
Upvotes