Dear django users,

when working on very large datasets (millions of items) and performing 
queries on it, I have a few questions regaring the performance.


   - From my understanding using `bool(qs)` is preferred over using 
   `qs.exists()` when the queryset is used later on, as `bool(qs)` already 
   evaluates and caches the qs, which `qs.exists()` does not. Is that correct?
   
   - Is the above assumption also true, when the qs that has bee evaluated 
   by using `bool(qs)` afterwards is accessed by e.g. 
   `qs.earliest(some_property)`,? 
   Or does `qs.earliest(some_property)` generate a new qs and hence there 
   is not really an advantage of having the original qs already evaluated by 
   `bool(qs)`?
   
   E.g. using `.filter()` will surely create and return a new qs, as stated 
   in the docu and in this case I am pretty sure, the advantage of evaluating 
   and caching the qs by using `bool(qs)` is lost here.
   But for `earliest()` or `latest()` the docu only states, that an object 
   is returned. It does not say anything about a new queryset being created.
   Hence my questions..
   

Thanks a lot and happy coding
Juergen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users/571d5cb6-bd53-4db4-aad1-2a820d71782en%40googlegroups.com.

Reply via email to