countQuery 최적화 질문
373
작성한 질문수 28
countQuery관련해서 궁금한 것이 있습니다.
@Override
public Page<ReportChangeKRWDto> search(ReportSearchRequestDto dto, Pageable pageable) {
List<ReportChangeKRWDto> content = queryFactory
.select(new QReportChangeKRWDto(
reportChange.id.intValue(), //번호는 일단 임의로
reportChange.referenceDate,
reportChange.changeAmount,
reportChange.beforeAsset,
reportChange.changeRatio,
reportChange.afterAsset)
)
.where(searchType(dto))
.from(reportChange)
.orderBy(sortCondition(dto))
.offset(pageable.getOffset())
.limit(10) //TOP 10 고정
.fetch();
//countQuery 따로
JPAQuery<Long> countQuery = queryFactory
.select(reportChange.count())
.from(reportChange)
.where(searchType(dto))
.orderBy(sortCondition(dto));
// .offset(pageable.getOffset())
// .limit(10);
return PageableExecutionUtils.getPage(content, pageable, countQuery::fetchOne);
}여기서 countQuery를 통해 최적화 하고 싶다면 countQuery부분에는 offset, limit을 빼고 쿼리?부분들만 적용해야 하는건가요 ??
답변 1
SpringBoot 4.X에서의 Querydsl 설정
0
92
2
querydsl 오픈소스에 대한 질문
0
73
1
예제에서의 카운트 쿼리에서 join문과 where문은 필요없지 않나요?
0
109
1
Querydsl 6.X버전에 대해서 어떻게 생각하시나요?
0
318
2
여러 테이블 조인하여 통계치를 구하고자 할 때 어떤 방법이 더 효율적일까요
1
71
1
fetchResults()는 더이상 권장되지 않는다는데 맞나요?
0
160
1
querydsl sum() 메서드 없어요.
0
160
2
build 디렉터리 생성
0
140
2
자바 ORM 표준 JPA 프로그래밍 - 기본편 듣고 바로 학습해도 괜찮을까요?
0
114
2
현재 Querydsl에서 from절 서브쿼리를 지원하나요?
0
92
1
오타 제보 드립니다.
0
73
2
벌크 연산과 flush, clear
0
76
1
Run As Intellij 로 변경시 Q타입 import 불가
0
88
1
QHello import하기 문제 발생
0
147
2
등록된 함수 보는법(H2Dialect) 질문
0
69
2
5.0부터 Querydsl은 향후 fetchCount() , fetchResult() 를 지원하지 않기로 결정했다고 하는데 이에 맞는 강의
1
199
2
[환경설정 PDF 부트 3.0이후 설명 질문] build.gradle에 compileQuerydsl을 정의하지 않은 상태에서 Gradle->Tasks->other->compileQuerydsl을 클릭하라고 하는 이유가 무엇인가요??
1
202
1
querydsl 설정 문제
0
222
2
quey dsl 설정부분
0
158
2
count 쿼리 관련 질문입니다!
0
75
1
stringtemplate를 이용하여 where절 검색 방법 질문 드립니다.
0
89
1
답변부탁드리겠습니다.
0
90
2
(OrderSpecifier)관련 내용 어디있을가요
0
66
1
중급문법 벌크연산에서
0
83
2





