-
Notifications
You must be signed in to change notification settings - Fork 8
refactor: DB Repository 계층 쿼리 성능 개선 (쿼리 구조 개선 + 인덱스 추가) #846
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
Merged
Hexeong
merged 5 commits into
develop
from
refactor/845-optimize-repository-query-plans
Sep 23, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f270189
refactor: 쿼리 플랜 조사 기반 Repository 계층 쿼리 성능 개선
Hexeong 8785457
fix: PR 리뷰 반영 - 활성 차단 중복 처리 및 게시판 전체 카테고리 인덱스 보강
Hexeong 8cdcc41
refactor: 조사 과정에서 남긴 주석을 정리
Hexeong 8799fd6
fix: 신고 이력 없는 유저의 reportedInfoResponse가 null이 되지 않도록 수정
Hexeong 8dbc113
chore: 개인 작업 지시 문서(AGENTS.local.md)를 gitignore에 추가
Hexeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
12 changes: 12 additions & 0 deletions
12
src/main/resources/db/migration/V60__add_query_plan_optimization_indexes.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ALTER TABLE post ADD INDEX idx_post_board_code_category_created_at (board_code, category, created_at); | ||
| ALTER TABLE post ADD INDEX idx_post_board_code_created_at (board_code, created_at); | ||
| ALTER TABLE post_image ADD INDEX idx_post_image_post_id (post_id); | ||
| ALTER TABLE post_like ADD INDEX idx_post_like_post_id (post_id); | ||
|
|
||
| ALTER TABLE chat_message ADD INDEX idx_chat_message_room_created_at (chat_room_id, created_at); | ||
|
|
||
| ALTER TABLE gpa_score ADD INDEX idx_gpa_score_verify_status_created_at (verify_status, created_at); | ||
| ALTER TABLE language_test_score ADD INDEX idx_language_test_score_verify_status_created_at (verify_status, created_at); | ||
|
|
||
| ALTER TABLE site_user ADD INDEX idx_site_user_status_created_at (user_status, created_at); | ||
| ALTER TABLE report ADD INDEX idx_report_reported_id (reported_id); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If two concurrent ban requests target the same user, both can pass
AdminUserBanService.validateNotAlreadyBannedbefore either transaction inserts, becauseuser_banhas no uniqueness constraint or locking for active bans. This query then returns both active rows, andCollectors.toMapthrowsIllegalStateExceptionfor the duplicate user ID, causing the entire restricted-user search request to fail. Select a deterministic active ban or provide a merge function while the underlying uniqueness invariant is enforced.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의견 감사합니다~ 동시 요청으로 같은 유저에게 활성 차단이 2건 이상 생길 수 있는 케이스를 실제로 재현해서 확인했고,
expiredAt내림차순 정렬 +Collectors.toMapmerge function(가장 늦게 만료되는 차단을 유지) 방식으로 반영했습니다. (8785457)