카운트 쿼리를 분리하여 쿼리 성능을 올릴 수 있다.
package study.datajpa.repository;
public interface MemberRepository extends JpaRepository<Member, Long> {
// 조회쿼리와 카운트 쿼리 분리
@Query(value = "select m from Member m left join m.team t",
countQuery = "select count(m.username) from Member m")
Page<Member> findPageSeparateCountByAge(int age, Pageable pageable);
...
}'Programing > Spring Boot' 카테고리의 다른 글
| Querydsl 에러 Could not autowire. No beans of 'JPAQueryFactory' type found. 에러 (0) | 2023.06.30 |
|---|---|
| 빌드 에러 error: as of release 5, 'enum' is a keyword, and may not be used as an identifier (0) | 2023.06.29 |
| Spring boot Data JPA 엔티티를 DTO로 조회하는 방법 (0) | 2023.06.28 |
| JPA 컬렉션을 페치조인하면 페이징이 불가능하다 (0) | 2023.06.28 |
| 코틀린 스프링부트 @RequestBody, @RequestParam, @PathVariable 사용법 (0) | 2023.06.21 |