[6주차/유리] 워크북 제출합니다#75
Open
Kohseoyoung wants to merge 1 commit into
Open
Conversation
YoungJJun
reviewed
May 8, 2026
Collaborator
YoungJJun
left a comment
There was a problem hiding this comment.
유리 키워드 조사 수고하셨습니다!
예시 코드가 많이 첨부되어 있어서 이해하기 좋은것 같아요.
피어리뷰, Swagger 캡쳐 미션이 진행이 아직 안되어 있는것 같아요! 진행 후 커밋해주시면 Approve 하겠습니다.
yeongjun25
reviewed
May 10, 2026
Comment on lines
+136
to
+145
| - 연관 관계가 설정된 엔티티를 조회할 때, 조회된 데이터 수(N)만큼 연관관계 조회 쿼리가 추가로 발생하는 현상 | ||
| - ex) 고양이 집사 10명이 각각 고양이 10마리를 키울 때 | ||
| - 집사 전체 조회 쿼리 1번 실행 | ||
| - 각 집사의 고양이 조회 쿼리 10번 추가 실행 | ||
| - 총 1+10 = 11번 쿼리 발생 → N+1 문제 ! | ||
|
|
||
| ### FetchType.LAZY로 바꾸면 해결될까? | ||
|
|
||
| - 아니다. FetchType을 LAZY로 바꾸면 처음엔 쿼리가 1번만 나가는 것처럼 보이지만, 실제로 연관 데이터(고양이 이름 등)를 사용하는 시점에 똑같이 N번의 추가 쿼리가 발생 | ||
| - LAZY는 N+1을 해결하는 게 아니라 발생 시점을 미루는 것. |
There was a problem hiding this comment.
N+1 문제를 이론적으로만 접하고 아직 실제로 마주한 적이 없어서 다소 추상적인 느낌이었는데
고양이 집사 예시가 되게 직관적이고 쉬운 설명인 거 같습니다!!
추가로 N+1 개념 조사하면서 "EAGER=성능적으로 위험함, LAZY=많이 쓰니까 괜찮은 방식"처럼 느껴졌었는데
LAZY가 근본적인 해결 방법이 아니라고 명시해주신 점 좋았습니다!
YoungJJun
approved these changes
May 11, 2026
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.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점