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

[Hotfix] Remove index using created_at to prevent performance issue #443

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

retroinspect
Copy link
Contributor

@retroinspect retroinspect commented Jan 23, 2024

  • Discussion message: https://sparcs.slack.com/archives/CV6H8N4EM/p1704937104870679

  • created_at 대신 id로 정렬하는 안 -> 다음 이유로 보류

    • id로 정렬하는 경우, 외부로부터 article을 export 해오는 경우 created_at과 id의 순서가 다를 수 있음 (e.g. 포탈 크롤러)
    • 기타 고려 사항:
      1. 어쨌든 composite index는 생성해야해서 (id, parent_board_id)를 생성하도록 수정했는데, 해당 index 생성이 이전과 마찬가지로 DB에 부하를 줄 가능성이 있음
      2. 프론트엔드에서 GET /articles?ordering=-created_at 으로 최신순 정렬하는 경우를 모두 GET /articles?ordering=-id로 바꿔주어야 함
  • Slow Query의 근본적인 원인이 created_at index의 부재가 아니였기 때문에 일단 index를 없애버림

@retroinspect retroinspect requested a review from injoonH January 23, 2024 12:30
@retroinspect retroinspect marked this pull request as draft January 23, 2024 12:38
@retroinspect retroinspect force-pushed the hotfix/article-index-change branch 2 times, most recently from a6cc0af to c5997bd Compare January 23, 2024 13:33
@retroinspect retroinspect marked this pull request as ready for review January 23, 2024 13:33
@retroinspect retroinspect force-pushed the hotfix/article-index-change branch from c5997bd to 326d0c3 Compare January 23, 2024 13:46
@retroinspect retroinspect changed the title [Hotfix] fix(article): use id instead of created_at for order_by [Hotfix] fix(article): remove index using created_at to prevent performance issue Jan 23, 2024
@injoonH injoonH changed the title [Hotfix] fix(article): remove index using created_at to prevent performance issue [Hotfix] Remove index using created_at to prevent performance issue Feb 13, 2024
@injoonH injoonH added the bug Something isn't working label Feb 13, 2024
@injoonH injoonH merged commit ec8f6f4 into master Feb 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants