Skip to content

Commit

Permalink
improve(env/featurestates): optimize n+1 queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Mar 4, 2022
1 parent 0f6c726 commit 73fd0e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/features/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ def get_queryset(self):
api_key=environment_api_key,
)

queryset = FeatureState.objects.filter(
environment=environment, feature_segment=None
queryset = (
FeatureState.objects.filter(environment=environment, feature_segment=None)
.select_related("feature", "feature_state_value")
.prefetch_related("multivariate_feature_state_values")
)

if identity_pk:
Expand Down

0 comments on commit 73fd0e8

Please sign in to comment.