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.
Uh oh!
There was an error while loading. Please reload this page.
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.
중복 키 제거 후 일반 인덱스를 추가해 주세요. 이메일로 사용자 조회가 빈번한 서비스 특성상, 유니크 키를 삭제하면 해당 컬럼의 인덱스 자체가 사라져 쿼리 성능이 급격히 떨어질 수 있어요. DROP 뒤에 동일 컬럼으로 일반 인덱스를 생성해 주시면 성능 저하를 예방할 수 있겠습니다.
ALTER TABLE site_user DROP KEY site_user_email_unique; +CREATE INDEX idx_site_user_email ON site_user (email);🤖 Prompt for AI Agents
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.
유니크 특정이 email + authType으로 되고 있고 그거에 대한 유니크 키(+ 인덱스)가 있는데 상관 없지 않아?
@coderabbitai
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.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1657
🏁 Script executed:
Length of output: 1090
🏁 Script executed:
Length of output: 8701
@Gyuhyeok99, 맞습니다! 제가 잘못 판단했네요. 😅
V3 마이그레이션에서 이미
uk_site_user_email_auth_type UNIQUE (email, auth_type)복합 유니크 키가 생성되어 있고, MySQL의 최좌측 프리픽스(leftmost prefix) 규칙에 따라(email, auth_type)인덱스는email단독 조회에도 효율적으로 사용될 수 있습니다.따라서
email단독 유니크 키를 제거하더라도 복합 인덱스가email필터링 쿼리의 성능을 충분히 보장하므로, 별도의 일반 인덱스를 추가할 필요가 없습니다.이전 제안을 철회합니다. 현재 마이그레이션 스크립트는 그대로 사용하셔도 문제없습니다! 👍