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

CLAP-407 task 테이블 인덱스 추가 및 작업 조회시 닉네임 검색 쿼리 수정 #528

Merged
merged 5 commits into from
Feb 13, 2025

Conversation

hyoseong-Choi
Copy link
Collaborator

@hyoseong-Choi hyoseong-Choi commented Feb 12, 2025

📄 요약(Summary)

task 테이블 인덱스 추가 및 작업 조회시 닉네임 검색 쿼리 수정

✍🏼 상세(More)

PR Desciption

변경 사항 설명

  • task 테이블 회원, 상태, 생성일로 인덱스 생성
  • 작업 조회시 닉네임 검색 쿼리 contains -> startwith 으로 수정

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

PR Log

PR 작업하면서 고민했던 내용, 해결한 내용, 고민 중인 내용 등

새롭게 배운 것

고민 중인 사항

첨부 자료

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

✅ 체크리스트(Checklist)

  • PR 양식에 맞게 작성했습니다
  • 모든 테스트가 통과했습니다
  • 프로그램이 정상적으로 작동합니다
  • 적절한 PR 라벨을 설정했습니다
  • 불필요한 코드를 제거했습니다

🚪 이슈 번호(Issue numbers)

Closes #526

@hyoseong-Choi hyoseong-Choi added ✨ feature 구현·개선 사항에 관련된 내용입니다 MID 우선순위 중 labels Feb 12, 2025
@hyoseong-Choi hyoseong-Choi self-assigned this Feb 12, 2025
Comment on lines 202 to 205
.select(taskEntity.count())
.from(taskEntity)
.where(builder)
.fetch().size();
.fetchOne();
Copy link
Collaborator

@parkjaehak parkjaehak Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 count 쿼리에서는 조인을 걸지 않으시고 일반 쿼리에서는 left join 되고 있어서 count 쿼리에도 left join이 필요할 것 같습니다.

Copy link
Collaborator

@parkjaehak parkjaehak Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예를들어 아래 쿼리는 processor, requester와의 조인된 결과(null인 경우 포함)를 가져옵니다.

        List<TaskEntity> result = queryFactory
                .selectFrom(taskEntity)
                .leftJoin(taskEntity.processor).fetchJoin()
                .leftJoin(taskEntity.requester).fetchJoin()
                .where(builder)
                .orderBy(orderSpecifier)
                .offset(pageable.getOffset())
                .limit(pageable.getPageSize())
                .fetch();

반면 아래는 task에 대한 개수만 가지고 옵니다.

 .select(taskEntity.count())
                .from(taskEntity)
                .where(builder)
                .fetchOne();

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다

Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@hyoseong-Choi hyoseong-Choi merged commit 35cca2b into develop Feb 13, 2025
1 check passed
@hyoseong-Choi hyoseong-Choi deleted the CLAP-407 branch February 13, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 구현·개선 사항에 관련된 내용입니다 MID 우선순위 중
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLAP-407 task 테이블 인덱스 추가 및 쿼리 수정
3 participants