Skip to content

Commit

Permalink
Merge pull request #372 from sparcs-kaist/hotfix/nplus1
Browse files Browse the repository at this point in the history
Add prefetch attachment to resolve nplus1
  • Loading branch information
injoonH authored Mar 9, 2023
2 parents 80b62af + 78c4302 commit 858d4d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/core/views/viewsets/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def filter_queryset(self, queryset):
name_type=BoardNameType.ANONYMOUS
)

queryset = queryset.prefetch_related(
'attachments'
)

# optimizing queryset for list action
queryset = queryset.select_related(
'created_by',
Expand Down

0 comments on commit 858d4d9

Please sign in to comment.