Skip to content
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

[REFACTOR] 태그 커버링 인덱스 적용 #762

Open
jminkkk opened this issue Oct 9, 2024 · 0 comments
Open

[REFACTOR] 태그 커버링 인덱스 적용 #762

jminkkk opened this issue Oct 9, 2024 · 0 comments
Labels
refactor 요구사항이 바뀌지 않은 변경사항

Comments

@jminkkk
Copy link
Contributor

jminkkk commented Oct 9, 2024

📌 어떤 기능을 리팩터링 하나요?

새 이름 목록으로 존재하는 이름을 조회하는 로직에 커버링 인덱스 재적용

#715에서 새 이름 목록으로 존재하는 이름을 조회하는 로직이 재변경되었습니다.
태그 엔티티가 필요한 것이 아니라 이름만 가져오면 되기 때문에, 전체 태그 조회는 성능상 불필요합니다.
때문에 기존 로직으로 롤백이 필요할 듯합니다.

AS-IS

두 쿼리를 직접 MySQL에 날려보면 실행 시간이 11.5ms에서 3.82ms로 약 3배 정도 차이가 발생합니다.

image
-> Filter: ((tag.`name` collate utf8mb4_bin) in ('tag1','tag2','tag3'))  (cost=1019 rows=9947) (actual time=11.5..11.5 rows=0 loops=1)
    -> Table scan on tag  (cost=1019 rows=9947) (actual time=0.488..10.2 rows=10000 loops=1)

TO-BE

image
-> Filter: ((tag.`name` collate utf8mb4_bin) in ('tag1','tag2','tag3'))  (cost=1019 rows=9947) (actual time=3.82..3.82 rows=0 loops=1)
    -> Covering index scan on tag using idx_tag_name  (cost=1019 rows=9947) (actual time=0.0784..3.03 rows=10000 loops=1)

⏳ 예상 소요 시간

10분

🔍 참고할만한 자료(선택)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor 요구사항이 바뀌지 않은 변경사항
Projects
None yet
Development

No branches or pull requests

1 participant