#37220: A Count-less Paginator for high-performance navigation
------------------------------------------+--------------------------------
Reporter: Harvey Bellini | Owner: Harvey Bellini
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: 6.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+--------------------------------
The new paginator provides a way to navigate results without performing a
COUNT(*) query, instead determining the existence of a "next page" by
fetching `N + 1` items.
**Problem**
On large PostgreSQL or MySQL tables, `SELECT COUNT(*)` requires a full or
partial index scan that scales linearly with data size. Even if the actual
data fetch is fast (via indexed slicing), the Paginator is forced to wait
for the count to:
- Validate the page number
- Determine if a "next" page exists
- Calculate the total number of pages for the UI
In many modern UIs (like "Infinite Scroll" or "Next/Prev" only
navigation), the total page count is unnecessary and actively hurts
performance.
https://github.com/django/new-features/issues/136
--
Ticket URL: <
https://code.djangoproject.com/ticket/37220>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.