I don't think this is an N+1, but it is a transaction that had a memcached get take 40s: New Relic Link
Somewhere in our haystack facet serializer we are making an N+1 call which recently resulted in 1000+ unnecessary DB hits which ended up degrading overall performance of the discovery service (and consequently the edx-mktg site as well)
The view in question is course-discovery/course_discovery/apps/edx_catalog_extensions/api/serializers.py:10
After a brief triage of this issue it is not apparent exactly where we need to add code to the query (select_related or prefetch_related) to prevent this N+1
There are also performance degradations in the top 3 slowest views that we don't have a lot of visibility into. 8+ seconds in the view layer. Adding key transactions here will give us more insight into how to fix.
Add key transactions to the top three slowest discovery views
Investigate removing haystack from facet views and querying elasticsearch directly