You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We make N+1 queries too often where we can get away with using Django optimisations. For example to fetch the workspace for user, or the user / workspace for current saved run / published run.
I haven't kept an exact track of the queries on each request, but I strongly feel like using these optimisations will cut down our queries by more than half.
Where we can do this:
during auth (both API and web) - AppUser.objects.prefetch_related('workspace_memberships__workspace__subscription')
when rendering workflow pages - SavedRun.objects.select_related('created_by'), PublishedRun.objects.select_related('saved_run', 'created_by', 'workspace__subscription')
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We make N+1 queries too often where we can get away with using Django optimisations. For example to fetch the workspace for user, or the user / workspace for current saved run / published run.
I haven't kept an exact track of the queries on each request, but I strongly feel like using these optimisations will cut down our queries by more than half.
Where we can do this:
AppUser.objects.prefetch_related('workspace_memberships__workspace__subscription')
SavedRun.objects.select_related('created_by')
,PublishedRun.objects.select_related('saved_run', 'created_by', 'workspace__subscription')
Probably more...
Beta Was this translation helpful? Give feedback.
All reactions