Re: LIMIT 21 on primary key lookups

2014-09-17 Thread Collin Anderson
We simply picked a number, not too large and not too small. The number 20 is now hardcoded as MAX_GET_RESULTS at the top of this file: https://github.com/django/django/blob/master/django/db/models/query.py Here's the discussion where the number came up:

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread Tim Chase
On 2014-09-14 13:23, James Bennett wrote: > This was something that could bite any user of Django with large > enough QuerySets, so the behavior was changed in upstream Django to > only show 20 objects. [snip] > This means that repr() on a QuerySet will never instantiate huge > numbers of

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread James Bennett
On Sun, Sep 14, 2014 at 12:48 PM, Ben Collier wrote: > So why 21, precisely? > I can't find the exact changeset in which it was introduced, but I do remember why :) There was an incident involving a large Django installation at World Online, where we were attempting to

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread Ben Collier
So why 21, precisely? On 14 September 2014 16:45, Alex French wrote: > Okay, after looking through the source code and documentation it seems > that django uses the limit for primary key lookups as a cautionary measure > and also to support the MultipleObjectsReturned

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread Alex French
Okay, after looking through the source code and documentation it seems that django uses the limit for primary key lookups as a cautionary measure and also to support the MultipleObjectsReturned exception in case something goes wrong. -- You received this message because you are subscribed to

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread Alex French
I realize that's how it's supposed to work, but this happens regardless of whether or not results are printed. If you use postgres with the tutorial project and look at the query log, you can see the limit clause applied to primary key lookups. -- You received this message because you are

Re: LIMIT 21 on primary key lookups

2014-09-14 Thread Josip Lazic
On Sunday, September 14, 2014 6:35:43 AM UTC+2, Alex French wrote: > > I'm using Django 1.7 and I noticed something odd in my postgres query > logs. Almost every query has a "LIMIT 21" clause, including queries of the > type "Thing.objects.get(pk=#)", which could only ever return one row. This

LIMIT 21 on primary key lookups

2014-09-13 Thread Alex French
I'm using Django 1.7 and I noticed something odd in my postgres query logs. Almost every query has a "LIMIT 21" clause, including queries of the type "Thing.objects.get(pk=#)", which could only ever return one row. This behavior seems odd to me, but so far I haven't seen it come up in a place