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

[BE] 최신 리뷰 조회를 no offset 방식으로 수정한다. #877

Open
yangdongjue5510 opened this issue Nov 18, 2022 · 0 comments
Open
Assignees
Labels
🖥️ backend 백엔드 🛠️ refactoring 리팩토링 📝 review 리뷰 관련

Comments

@yangdongjue5510
Copy link
Collaborator

목표

기존에 최신 리뷰 조회는 offset 방식으로 페이지네이션 되고 있었다. offset 페이지네이션 방식은 처음부터 해당 페이지에 포함되는 데이터까지를 조회해서 해당 페이지에 포함되는 데이터만 남기고 다 버린다.
만약 10개씩 101번째 페이지를 조회하려면 101*10개의 데이터를 조회하고 마지막 10개만 반환한다.
이런 식으로 페이지 수가 큰 페이지를 요청할 수록 성능이 떨어진다.

no offset 페이징 방식은 이전에 요청했던 페이지의 마지막 데이터의 위치를 전달한다. 해당 위치 다음 데이터부터 페이지의 사이즈만큼 데이터를 읽기만 하면 된다.
no offset 페이징을 위해서는 유니크한 하나의 칼럼으로 정렬할 때 가장 큰 성능적 효과를 이루게 된다.
현재 우리 서비스의 API에서 유니크한 하나의 칼럼으로 정렬하는 API는 최신 리뷰 조회이다.
최신 리뷰 조회를 no offset 페이징으로 변경한다.

주의사항(Optional)

최초 요청 시 이전 데이터의 위치를 프론트에서 보내지 않아도 페이징에 성공해야 한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖥️ backend 백엔드 🛠️ refactoring 리팩토링 📝 review 리뷰 관련
Projects
None yet
Development

No branches or pull requests

1 participant