Re: Queryset cloning is very expensive

2011-03-22 Thread Malte Engelhardt
Sorry for the late response. Maybe it's sufficient to override the QuerySet clone method to just return self, not really clone it. 2011/2/14 myx > Thank you for the reply. But I meant a slightly different case: > > Item.objects.filter(...).order_by(...).values_list('id', flat=True)[: > 10] > >

Re: Queryset cloning is very expensive

2011-03-12 Thread Alexander Schepanovski
On 14 фев, 15:21, myx wrote: > Thank you for the reply. But I meant a slightly different case: > > Item.objects.filter(...).order_by(...).values_list('id', flat=True)[: > 10] > > As you can see, there are four cloning operations. Wouldn't be > chaining possible without cloning the queryset? The me

Re: Queryset cloning is very expensive

2011-02-24 Thread Karen Tracey
On Thu, Feb 24, 2011 at 11:20 AM, myx wrote: > I found a solution which is suitable for me. > As it turns out, all those methods just clone queryset, and then call > appropriate methods of Query object. > So, for example, to set ordering and to get a slice without cloning > queryset, I can do the

Re: Queryset cloning is very expensive

2011-02-24 Thread myx
I found a solution which is suitable for me. As it turns out, all those methods just clone queryset, and then call appropriate methods of Query object. So, for example, to set ordering and to get a slice without cloning queryset, I can do the following: qs.query.add_ordering('-created') qs.query.s

Re: Queryset cloning is very expensive

2011-02-14 Thread myx
Thank you for the reply. But I meant a slightly different case: Item.objects.filter(...).order_by(...).values_list('id', flat=True)[: 10] As you can see, there are four cloning operations. Wouldn't be chaining possible without cloning the queryset? The method could just return the original querys

Re: Queryset cloning is very expensive

2011-02-11 Thread kurvenschubser
Hi myx, cloning is useful for chaining of filters, e.g. User.objects.filter(name="Harry").exclude(lastname="Potter").filter(somethingelse="bla") But most of the time, I found I can construct querysets using a dictionary for collecting the query conditions: d = {name:"Harry", lastname:"Potter", s