Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 관련 이슈
💗 작업 동기
기존 findNearbyPosts()는 Post별 이미지·태그 데이터를 각각 조회하는 방식으로 N+1 쿼리 문제가 존재했으며, 하트 수 계산 시 집계 연산이 반복되어 성능 저하가 발생했습니다. 대량 데이터 환경에서의 응답 속도를 개선하기 위해 구조 및 쿼리를 리팩토링하였습니다.
🛠️ 작업 내용
아래의 문제를 v2버전의 파일(controller, service, repository, mapper)을 생성한 뒤 ("api/v2/posts/neartby)를 API를 호출하면 리팩토링한 코드를 확인할 수 있습니다.
🎯 리뷰 포인트
Post 이미지, 태그, 하트 수가 각 Post에 정확히 매핑되는지
MyBatis XML 쿼리 성능 및 인덱스 활용 가능 여부