#6785: QuerySet.get() should only attempt to fetch a limited number of rows
-------------------------------------+-------------------------------------
     Reporter:  deadwisdom           |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  master
    Component:  Database layer       |               Resolution:
  (models, ORM)                      |             Triage Stage:  Accepted
     Severity:  Normal               |      Needs documentation:  0
     Keywords:                       |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 Limiting the fetches doesn't work that well on most core databases. If I
 recall correctly sqlite, postgresql and mysql all do transfer all of the
 rows of the query when accessing the results (for PostgreSQL I know this
 is the case). So, while limiting the fetches would result in less model
 instances being generated, the overhead of generating all the rows in the
 database and transferring the results would still be there.

 To get rid of clone() overhead we could just call query.set_limits()
 manually.

 With this all being said... I guess we are optimizing the wrong case here.
 Successful .get() (just one row returned) should be optimized, not the
 error case. I am not sure how much overhead LIMIT (or the nested selects
 on Oracle) cost.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/6785#comment:8>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.6dc8891d6b5c1fb9caf4414a57c6eabf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to