Open
Description
I noticed today that Sentry was reporting a possible N+1 query issue on the dashboard homepage.
Here's the query that Sentry is claiming is being repeated:
SELECT dashboard_datum.id, dashboard_datum.content_type_id, dashboard_datum.object_id,
dashboard_datum.timestamp, dashboard_datum.measurement
FROM dashboard_datum
WHERE (
dashboard_datum.content_type_id = %s AND dashboard_datum.object_id = %s
)
ORDER BY dashboard_datum.timestamp DESC
LIMIT 1
I'd recomment trying to see ifthe Django Debug Toolbar (installed by default I think) is reporting the duplicated query also. And if so, we should try to fix it. Usually it's a matter of adding a select_related()
or prefetch_related()
somewhere in the view, but it might also be more complicated than that.