#15361: QuerySet.get() should use LIMIT 2 --------------------------------------------------------+------------------- Reporter: mbertheau | Owner: mmcnickle Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Resolution: | Keywords: QuerySet get limit MultipleObjectsReturned Triage Stage: Accepted | Has patch: 1 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | --------------------------------------------------------+------------------- Changes (by mmcnickle):
* owner: nobody => mmcnickle Comment: The concern that this change may make the get() slower may be valid, but one thing is for sure, that benchmark is inadequate for anything but huge performance regressions. I'm able to produce "Significant" slower results by running 2 identical versions of django: {{{ Running all benchmarks Control: Django 1.3 beta 1 (in django-control) Experiment: Django 1.3 beta 1 (in django-experiment) Running 'query_get' benchmark ... Min: 0.020000 -> 0.020000: no change Avg: 0.022400 -> 0.024800: 1.1071x slower Significant (t=-2.556039) Stddev: 0.00431 -> 0.00505: 1.1698x larger (N = 50) }}} The telling fact is that these "significant" results are transient, differing from run to run. I'll write a benchmark that will properly stress the query.get() and see if: a) There is a performance regression for pk (or other fields with unique constraints) lookups[[BR]] b) There is a performance increase for non-indexed, large match lookups. If (b) and not (a), it's a +1.[[BR]] If (a) and (b), it's probably a -1, given the more usual case in (a)[[BR]] If (a) and not (b), -1 -- Ticket URL: <http://code.djangoproject.com/ticket/15361#comment:7> Django <http://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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.