Avoid Counting in Django Pagination
Briefly

Django's default Paginator relies on the object COUNT(*) query to calculate the number of pages, which can significantly slow down with database growth.
This article suggests implementing a paginator that avoids the object COUNT(*) query entirely, focusing on scenarios where knowing the exact number of pages isn't necessary.
For a practical example, the article guides you through setting up a simple Django app that stores log messages and serves them via a paginated API.
To benchmark performance, the tutorial details using Django Silk to track database query times and view load times, helping assess the paginator's efficiency.
Read at Testdriven
[
|
]