Skip to content

Conversation

@sangcci
Copy link
Collaborator

@sangcci sangcci commented Mar 27, 2025

연결된 issue 🌟

구현 내용 📢

1. 역정규화 진행

차량 대절 신청 인원에 대해 역정규화를 진행했습니다.
더이상 RentJoinSUM(passenger_num)할 필요 없이, 바로 RentBoardingInfo 테이블에서 passenger_count를 조회하면 됩니다.

2. 테이블 이름 수정

  • rent_form -> rent
  • rent_form_boarding_date -> rent_boarding_info
  • rent_join -> 그대로

3. 쿼리 개선

rentrent_boarding_info, rent_join인 간 JOIN 하는 과정에서 병목 현상을 발견했습니다.
이에 제대로 식별자를 통해 구분할 수 있도록 JOIN 조건 절을 수정했습니다.

4. 인덱스 추가

  • rent_join member_id 인덱스 추가
  • rent_boarding_info (rent_id, date) 인덱스 추가

성능 개선을 통해 100만개 테스트 데이터 기준, 1분 이상 걸리던 조회가 약 200ms로 줄었습니다~

테스트 결과 🧩

정상 동작합니다~

리뷰 포인트 📌

  • 쿼리 변경
  • 인덱스
  • 컬럼 수정 및 테이블명 수정으로 인한 side effect 가능성

@sangcci sangcci added 🐛 fix 수정 작업 🔨 refactor 리펙토링 작업 labels Mar 27, 2025
@sangcci sangcci requested a review from Copilot March 27, 2025 18:00
@sangcci sangcci self-assigned this Mar 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves query performance for vehicle rental requests by denormalizing passenger counts, updating table and column names, and optimizing join conditions with added indexes.

  • Changed table names and updated query joins to use the new RentBoardingInfo table instead of RentBoardingDate.
  • Removed unused entities and repositories, and updated domain models and repository interfaces accordingly.
  • Improved performance by updating query join conditions and adding necessary indexes.

Reviewed Changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java/com/backend/allreva/rent/infra/rdb/RentDslRepositoryImpl.java Updated query joins and projections to use RentBoardingInfo.
src/main/java/com/backend/allreva/rent/infra/rdb/RentBoardingInfoJpaRepository.java Introduced new repository interface for RentBoardingInfo.
src/main/java/com/backend/allreva/rent/infra/rdb/RentBoardingDateJpaRepository.java Removed the obsolete RentBoardingDate repository.
src/main/java/com/backend/allreva/rent/command/domain/value/AdditionalInfo.java Removed recruitmentCount field in favor of denormalizing via RentBoardingInfo.
src/main/java/com/backend/allreva/rent/command/domain/Rent.java Renamed table and updated associations to use boardingInfos.
src/main/java/com/backend/allreva/rent/command/application/request/RentRegisterRequest.java Updated entity creation to use RentBoardingInfo instead of RentBoardingDate.
src/main/java/com/backend/allreva/rent/command/application/RentCommandService.java Updated deletion logic to match the new boarding info structure.
Various security configuration files Removed local test security configurations and filters.
Comments suppressed due to low confidence (1)

src/main/java/com/backend/allreva/rent/command/application/request/RentRegisterRequest.java:71

  • [nitpick] Consider renaming 'rentBoardingDateRequests' to 'rentBoardingInfoRequests' for consistency with the updated domain model.
List<RentBoardingInfo> rentBoardingInfos = rentBoardingDateRequests.stream()

@sangcci sangcci merged commit e0650a6 into develop Mar 28, 2025
2 checks passed
@sangcci sangcci deleted the feat/rent branch March 28, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 fix 수정 작업 🔨 refactor 리펙토링 작업

Projects

None yet

Development

Successfully merging this pull request may close these issues.

차량 대절 쿼리 성능 개선

2 participants