Adds automatic query optimization to detect and apply select_related and prefetch_related for serializers. Includes OptimizedQuerySetMixin and N+1 detection utility.