#35733: Page.__len__ could skip a query if self.paginator.count == 0
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  Jacob
         Type:                       |  Walls
  Cleanup/optimization               |                   Status:  closed
    Component:  Core (Other)         |                  Version:  dev
     Severity:  Normal               |               Resolution:  invalid
     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 Jacob Walls):

 * resolution:   => invalid
 * status:  assigned => closed

Comment:

 In writing a test case, I discovered that I failed to confirm the no-data
 case does any additional select query. In the no-data case, a slice of the
 queryset from [0:0] is taken, which the ORM knows not to perform a query
 for. So there is nothing to optimize here.


 In `Paginator.page()`, `bottom` and `top` are both 0 if the count is 0:
 {{{
         return self._get_page(self.object_list[bottom:top], number, self)
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35733#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191cc7e3ffe-e5da30ee-f22c-4d72-a6bb-8ecb88d3e7b9-000000%40eu-central-1.amazonses.com.

Reply via email to