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(room-user, typeorm): 중복 조인 쿼리 최적화 #244

Open
vimkim opened this issue Jan 8, 2024 · 0 comments
Open

Refactor(room-user, typeorm): 중복 조인 쿼리 최적화 #244

vimkim opened this issue Jan 8, 2024 · 0 comments
Assignees

Comments

@vimkim
Copy link
Collaborator

vimkim commented Jan 8, 2024

♻️ 리팩토링 사항

  async findRoomUsersByRoomCode(roomCode: string) {
    return this.roomUserRepository.find({
      where: { room: { code: roomCode } },
    });
  }

room-user.service.ts에 존재하는 위 코드를 실행시켰을 때,
우려하던 N+1 문제는 다행히 발생하지 않지만, 여러 번의 불필요한 중복 조인이 발생합니다.
안일한 eager loading의 사용이 원인이라고 추정하고 있습니다.

@vimkim vimkim self-assigned this Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant