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

[BE/PERF] 홈화면 API와 켈린더 상세 조회 API에 사용되는 쿼리 개선 #469

Merged
merged 3 commits into from
Aug 17, 2024

Conversation

hwangdaesun
Copy link
Collaborator

@hwangdaesun hwangdaesun commented Aug 17, 2024

📌 관련 이슈

#468

🔑 주요 변경사항

테이블의 인덱스를 잘 사용할 수 있는 방향으로 쿼리 분리

기존 쿼리

select m from MealEntity m join fetch m.mealFoodEntity mf join fetch mf.foodEntity where m.createdDate >= :today and m.createdDate < :tomorrow and m.memberEntity.id = :memberId

변경 쿼리

select m.id from MealEntity m where m.memberEntity.id = :memberId and m.createdDate >= :today and m.createdDate < :tomorrow

select mft from MealFoodEntity mft join fetch mft.foodEntity where mft.mealEntity.id in :ids

아래 PR에 수정한 쿼리와 완전히 동일한 형식의 쿼리이기 때문에 상세한 설명은 아래 PR로 대체

#452

Copy link
Collaborator

@LJH098 LJH098 left a comment

Choose a reason for hiding this comment

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

so good
먼저 id를 찾고 그 다음 pk로 조회를 하는게 멋지네요

@LJH098 LJH098 merged commit 0f717c6 into be Aug 17, 2024
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.

2 participants