feat: feed 조회 시 university_id, category_id, pinned, created_date 기준 복합 인덱스 추가하여 조회 성능 개선#370
Open
feat: feed 조회 시 university_id, category_id, pinned, created_date 기준 복합 인덱스 추가하여 조회 성능 개선#370
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.
🛠️ 작업 내용
feed(university_id, category_id, pinned DESC, created_date DESC)idx_feed_uni_cat_orderV32__Add_feed_university_category_pinned_created_index.sql📊 성능 측정 결과 (데이터 총 400만 건; 조합당 10만 건)
⚖️ 트레이드오프
✅ 결론(의사결정)
트레이드오프(쓰기 지연 증가, 인덱스 용량 증가)를 검토했지만, 조회 성능 개선 효과가 더 효과적이라고 판단하였습니다.
filesort제거, 후반 페이지에서도 안정적 성능pinned/created_date변경 빈도는 낮아 쓰기 비용은 수용 가능따라서 4컬럼 복합 인덱스
(university_id, category_id, pinned DESC, created_date DESC)를 적용하였습니다
✅ 적용 SQL (Flyway)
🔍 검증 방법 (체크리스트)
기대: Using filesort 제거, Index lookup using idx_feed_uni_cat_order
🎯리뷰 포인트