GETP-324 feat: 프로젝트 테이블 인덱스 설계를 위한 배치 프로그램 작성 #181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ 구현한 기능
@Id
가@GeneratedValue(strategy = GenerationType.IDENTITY)
이기 때문에EntityManager
를 사용해서 배치INSERT
가 불가능해요. 그래서JdbcTemplate
를 사용해서 배치 처리를 진행했으나, 100,000건의 데이터를 처리하려니 속도가 너무 느렸어요. 그래서CompletableFuture
를 사용해 병렬 처리를 진행하고, JDBC의 설정에서rewriteBatchedStatements=true
를 하여 기존 속도 74,981 ms에서 2,463 ms로 약 24.34배 개선했어요.📢 논의하고 싶은 내용
JdbcTemplate
를 사용하다 보니 컴파일 타임에 쿼리 오류를 체크할 수 없다는 것이 문제에요. 그리고 확실히 JPA 엔티티와EntityManager
를 사용하는 것보다 작성해야 하는 코드가 훨씬 더 많아졌어요.🎸 기타