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] 템플릿 좋아요 최적화 #741

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

[REFACTOR] 템플릿 좋아요 최적화 #741

jminkkk opened this issue Oct 5, 2024 · 0 comments
Assignees
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항

Comments

@jminkkk
Copy link
Contributor

jminkkk commented Oct 5, 2024

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

템플릿 조회 시 좋아요 테이블에 조인하여 좋아요 수를 저장해놓도록 변경합니다.

AS-IS

현재 템플릿 엔티티에 @Fomula를 통해 좋아요 갯수를 가져오고 있습니다.
결국 매 템플릿 조회마다 좋아요 테이블에 조인하여 count 연산을 하여 가지고 오게 됩니다.
좋아요 갯수가 커질수록 조인으로 인한 오버헤드가 커지기 때문에 템플릿 당 좋아요 갯수를 저장하도록 반정규화합니다.

TO-BE

템플릿 조회 시 이미 연산된 좋아요 카운트를 조회만 하면되도록 변경합니다.
동시에 예상되는 데이터 정합성에 대한 문제도 고민이 필요할듯합니다.

⏳ 예상 소요 시간

2일

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

좋아요 개수 조회 최적화하기

@jminkkk jminkkk added the refactor 요구사항이 바뀌지 않은 변경사항 label Oct 5, 2024
@jminkkk jminkkk self-assigned this Oct 5, 2024
@Jaymyong66 Jaymyong66 added the BE 백엔드 label Oct 20, 2024
@Jaymyong66 Jaymyong66 added this to the 6차 스프린트 🦴 milestone Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항
Projects
Status: Todo
Development

No branches or pull requests

2 participants