테이블 전체 로우를 날리고싶을 때 delete() ,deleteAll()을 사용하면 데이터가 많은 경우 너무 느린 단점이 있다.
truncate를 사용하면 빠르게 전체 로우를 삭제할 수 있으며 index는 1부터 새로 시작한다.
@Transactional
@Modifying
@Query(value = "truncate table a", nativeQuery = true)
void truncate();
'JPA' 카테고리의 다른 글
Executing an update/delete query 에러 (0) | 2022.09.01 |
---|