Changes between Initial Version and Version 1 of Ticket #35779, comment 2
- Timestamp:
- Sep 20, 2024, 4:53:46 PM (3 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35779, comment 2
initial v1 1 2 1 3 Consider 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 2 4 5 6 {{{ 3 7 User.objects.prefetch_related( 4 8 Prefetch("email_set", queryset=Email.objects.only("user_id", "email")) 5 9 ) 10 }}} 11