student_number 컬럼에 인덱스 추가 - #218
Merged
Merged
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
#️⃣연관된 이슈
📝작업 내용
UserJpaEntity의student_number컬럼에 인덱스(idx_tb_user_student_number) 추가SearchUsersServiceImpl(관리자용 학생 검색)에서 학번 범위(BETWEEN) 조건으로 자주 필터링되는 컬럼인데 인덱스가 없어 항상 풀스캔이 발생하던 문제 개선ddl-auto: update이므로 엔티티의@Table(indexes = ...)가 곧 실제 스키마에 반영됨성능 측정
별도 격리된 Postgres 16 컨테이너에
tb_user와 동일한 스키마로 테스트 데이터 50만 건을 시딩하고,searchUsers쿼리와 동일한 조건으로EXPLAIN ANALYZE비교쿼리:
WHERE role <> 'ADMIN' AND name LIKE '%' AND student_number BETWEEN 1101 AND 1199(한 반 학생 조회, 약 16,500건 매치)약 21배 빨라짐 (81.4ms → 3.8ms), 조회 페이지 수도 6662 → 514로 약 13배 감소
특정 학번 1명만 조회하는 경우(
BETWEEN 2345 AND 2345)는 인덱스 적용 후 1.594 ms로 단일 유저 조회에도 효과 확인스크린샷 (선택)
💬리뷰 요구사항(선택)