Skip to content

[REFACTOR] GET /novels/taste 응답 지연 개선 - #592

Merged
GiJungPark merged 2 commits into
devfrom
refactor/#591
Aug 5, 2026
Merged

[REFACTOR] GET /novels/taste 응답 지연 개선#592
GiJungPark merged 2 commits into
devfrom
refactor/#591

Conversation

@ljy1348

@ljy1348 ljy1348 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Related Issue

Key Changes

  • 선호 장르 추천 후보를 애플리케이션에서 전체 조회한 뒤 중복 제거하던 로직을 DB의 GROUP BYMAX(user_novel_id) 기준 정렬, LIMIT 10으로 변경했습니다.
  • 선별된 작품의 novel_statistics를 페치 조인해 후보 작품마다 발생하던 통계 조회 N+1을 제거했습니다.
  • 관심 수는 기존 작품별 일괄 집계 쿼리를 재사용하고, 평점과 평가 수는 novel_statistics에서 조회해 userNovels 컬렉션 로딩을 제거했습니다.
  • 추천 작품의 기존 최신순 의미를 유지하며 원본 로그 기준 125개였던 조회 쿼리를 구조상 약 5개로 줄였습니다.
  • 일괄 집계 결과 매핑과 통계가 없는 작품의 기본값을 검증하는 테스트를 추가했습니다.

To Reviewers

  • 추천 순서는 작품별 가장 큰 user_novel_id를 기준으로 유지합니다.
  • novel_statistics가 없는 작품은 기존 응답처럼 평점과 평가 수를 0으로 반환합니다.
  • 관련 단위 테스트는 모두 통과했습니다.
  • 전체 257개 테스트 중 12개는 로컬 테스트 데이터소스 드라이버 미설정, 1개는 기존 RecentSearchServiceTest의 null ID 문제로 실패했습니다.
  • 개선 후 실제 API 응답 시간과 쿼리 수는 인증 가능한 실행 환경에서 재측정이 필요합니다.

References

@GiJungPark GiJungPark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다~!

@GiJungPark
GiJungPark merged commit c851855 into dev Aug 5, 2026
2 checks passed
@GiJungPark GiJungPark added bug Something isn't working domain: novel labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working domain: novel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] GET /novels/taste 응답 지연 개선

2 participants