Lesson 25 / 34

Performance Optimization

Speed up NestJS apps by selecting only needed columns, adding indexes, batching queries and avoiding N+1 loads.

Query optimization

Use select to fetch only needed columns; use indices in the DB; batch queries where possible.

N+1 problem

Avoid loading related entities in a loop—use leftJoinAndSelect() or batch loaders to fetch all at once.