Lesson 25 / 33

Performance Optimization

Optimize queries, use caching, and profile bottlenecks.

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.