Changes between Initial Version and Version 1 of Ticket #35779, comment 2


Ignore:
Timestamp:
Sep 20, 2024, 4:53:46 PM (8 weeks ago)
Author:
GunSliger00007

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35779, comment 2

    initial v1  
     1
     2
    13Consider optimizing your queries by prefetching only the fields you need. In your case, you’re already using only() to limit the fields loaded by the query, which helps reduce the amount of data loaded into memory.If the related Email objects are large, consider using .values() or .values_list() to reduce the amount of data furthe
    24
     5
     6{{{
    37User.objects.prefetch_related(
    48    Prefetch("email_set", queryset=Email.objects.only("user_id", "email"))
    59)
     10}}}
     11
Back to Top