Changes between Version 1 and Version 2 of Ticket #25787, comment 3


Ignore:
Timestamp:
Nov 21, 2015, 9:08:57 AM (9 years ago)
Author:
Justus Adam

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25787, comment 3

    v1 v2  
    11If that executes lazily then I am ok with this, thank you.
    22
    3 However looking at the code for QuerySet it defines an {{{__iter__}}} method but no {{{__contains__}}} method and {{{__iter__}}} executes {{{_fetch_all}}}, which means instead of doing an {{{.exists()}}} query using {{{in}}} on a query set fetches a large number of objects and iterates over the result. This is very inefficient.
     3However looking at the code for QuerySet it defines an {{{__iter__}}} method but no {{{__contains__}}} method and {{{__iter__}}} executes {{{_fetch_all}}}, which means instead of doing an {{{.exists()}}} query using {{{in}}} on a query set fetches a large number of objects and iterates over the result objects rather than using the database aided {{{.exists()}}}.
     4This is very inefficient.
Back to Top