[Django] #26451: extend Paginator to support infinite pagination and postgres estimated count

24 views
Skip to first unread message

Django

unread,
Apr 3, 2016, 7:41:44 AM4/3/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+--------------------
Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------
We often have problems with bigger tables and slow {{count(*)}}
performance.

depending on the use-case there are two ways to improve the situation
* just work without count, if you never show the page-count. Then the
paginator can just return empty results if the end is near.
* use rough estimations for the page-count, perhaps with some security
margin. For example PostgreSQL supports this by using {{EXPLAIN}}, based
on the table statistics.

I want to
* extend the paginator to support both (infinite and estimate)
* provide an option for {{ModelAdmin}} that let's you use the estimation-
paginator.
* or perhaps even support the infinite-paginator, this would also include
interface changes to the pagination.

--
Ticket URL: <https://code.djangoproject.com/ticket/26451>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 3, 2016, 7:42:08 AM4/3/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+--------------------------------------

Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by syphar):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> We often have problems with bigger tables and slow {{count(*)}}
> performance.
>
> depending on the use-case there are two ways to improve the situation
> * just work without count, if you never show the page-count. Then the
> paginator can just return empty results if the end is near.
> * use rough estimations for the page-count, perhaps with some security
> margin. For example PostgreSQL supports this by using {{EXPLAIN}}, based
> on the table statistics.
>
> I want to
> * extend the paginator to support both (infinite and estimate)
> * provide an option for {{ModelAdmin}} that let's you use the estimation-
> paginator.
> * or perhaps even support the infinite-paginator, this would also include
> interface changes to the pagination.

New description:

We often have problems with bigger tables and slow {{{count(*)}}}
performance.

depending on the use-case there are two ways to improve the situation
* just work without count, if you never show the page-count. Then the
paginator can just return empty results if the end is near.
* use rough estimations for the page-count, perhaps with some security
margin. For example PostgreSQL supports this by using {{EXPLAIN}}, based
on the table statistics.

I want to
* extend the paginator to support both (infinite and estimate)
* provide an option for {{ModelAdmin}} that let's you use the estimation-
paginator.
* or perhaps even support the infinite-paginator, this would also include
interface changes to the pagination.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:1>

Django

unread,
Apr 3, 2016, 7:44:52 AM4/3/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+------------------------------------

Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by syphar):

* stage: Unreviewed => Accepted


Comment:

setting triage to accepted after discussion with Russell Keith-Magee

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:2>

Django

unread,
Apr 3, 2016, 8:17:03 AM4/3/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+------------------------------------

Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Description changed by syphar:

Old description:

> We often have problems with bigger tables and slow {{{count(*)}}}
> performance.
>
> depending on the use-case there are two ways to improve the situation
> * just work without count, if you never show the page-count. Then the
> paginator can just return empty results if the end is near.
> * use rough estimations for the page-count, perhaps with some security
> margin. For example PostgreSQL supports this by using {{EXPLAIN}}, based
> on the table statistics.
>
> I want to
> * extend the paginator to support both (infinite and estimate)
> * provide an option for {{ModelAdmin}} that let's you use the estimation-
> paginator.
> * or perhaps even support the infinite-paginator, this would also include
> interface changes to the pagination.

New description:

We often have problems with bigger tables and slow {{{count(*)}}}
performance.

depending on the use-case there are two ways to improve the situation
* just work without count, if you never show the page-count. Then the
paginator can just return empty results if the end is near.
* use rough estimations for the page-count, perhaps with some security
margin. For example PostgreSQL supports this by using {{{EXPLAIN}}}, based
on the table statistics.

I want to
* extend the paginator to support both (infinite and estimate)
* provide an option for {{{ModelAdmin}}} that let's you use the
estimation-paginator.
* or perhaps even support the infinite-paginator, this would also include
interface changes to the pagination.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:3>

Django

unread,
Apr 9, 2016, 3:47:39 AM4/9/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+------------------------------------

Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by claudep):

For MySQL, see also http://django-
mysql.readthedocs.org/en/latest/queryset_extensions.html#approximate-
counting
We might create a separate ticket to add the approximate count to the
queryset API.

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:4>

Django

unread,
Apr 9, 2016, 4:43:19 AM4/9/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
------------------------------+------------------------------------

Reporter: syphar | Owner: syphar
Type: New feature | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by syphar):

thanks claudep for the mysql link, codingjoe and me had the same idea
about adding this to the db-backends and queryset, and then (optionally)
using it for the paginator

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:5>

Django

unread,
Nov 5, 2016, 10:24:32 AM11/5/16
to django-...@googlegroups.com
#26451: extend Paginator to support infinite pagination and postgres estimated
count
-------------------------------+-----------------------------------------
Reporter: Denis Cornehl | Owner: Denis Cornehl
Type: New feature | Status: closed

Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Changes (by Denis Cornehl):

* status: new => closed
* resolution: => wontfix


Comment:

will create a 3rd party library for this

--
Ticket URL: <https://code.djangoproject.com/ticket/26451#comment:6>

Reply all
Reply to author
Forward
0 new messages