Unpaginated queries on large tables cause expensive operations
warningperformanceUpdated Mar 22, 2026(via Exa)
Technologies:
How to detect:
Using Order.objects.all() or similar queries on tables with thousands of rows without pagination or filtering results in expensive database operations and slow API responses as entire datasets are fetched and serialized.
Recommended action:
Implement pagination for all list endpoints using Django's pagination features, add filtering capabilities to limit result sets, use .only() or .values() to limit fields returned, and avoid fetching complete datasets without constraints.