Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] 감상 조회시 N+1 문제 해결 #394

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

Jaeyoung22
Copy link
Collaborator

@Jaeyoung22 Jaeyoung22 commented Sep 21, 2023

📌 관련 이슈

📁 작업 설명

  • 감상 조회시 N+1문제가 있었습니다.
  • Fetch Join으로 해결했습니다.
  • 추가로, 전체 감상 조회시 trip을 다시 조회하는 경우가 있었습니다.
  • 그래서 trip도 fetch join했습니다.

=> trip을 사용하지 않아서, Point에서 Trip을 Lazy Loading 하도록 설정했습니다.

@Jaeyoung22 Jaeyoung22 changed the title Refactor/#387 [refactor] 감상 조회시 N+1 문제 해결 Sep 21, 2023
@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Test Results

238 tests   238 ✔️  20s ⏱️
  67 suites      0 💤
  67 files        0

Results for commit fbfa56d.

♻️ This comment has been updated with latest results.

Copy link
Member

@greeng00se greeng00se left a comment

Choose a reason for hiding this comment

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

사용하지 않는 trip을 join 하는데 LAZY로 설정하는거에 대해서는 어떻게 생각하시나요?

Copy link
Collaborator

@Combi153 Combi153 left a comment

Choose a reason for hiding this comment

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

검증 방법만 알려주시면 감사하겠습니다!

Comment on lines 26 to 27
.leftJoin(post.point).fetchJoin()
.leftJoin(post.point.trip).fetchJoin()
Copy link
Collaborator

Choose a reason for hiding this comment

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

혹시 검증을 어떻게 하셨나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

쿼리 개수를 테스트에서 확인하는 방법을 아직 몰라서 테스트 돌리고 나간 쿼리와 갯수를 확인했습니다.

Copy link
Member

@greeng00se greeng00se left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 👍

Copy link
Collaborator

@Combi153 Combi153 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

짱입니다~

@Jaeyoung22 Jaeyoung22 merged commit c82f5fd into develop-backend Sep 21, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants