작성
·
360
답변 2
1
안녕하세요. Kata Coder님
https://www.logicbig.com/tutorials/spring-framework/spring-data/derived-count-query.html는 DB에 저장된 데이터 수를 세는 쿼리를 만들어주는 기능입니다^^
원하시는 기능은 다음 옵션을 사용하시면 됩니다^^
hibernate.generate_statistics=true
성능에 영향을 미치니 로컬이나, 개발서버에서만 사용하시는게 좋습니다^^
2020-09-17 16:55:41.800 INFO 2852 --- [nio-8080-exec-4] i.StatisticalLoggingSessionEventListener : Session Metrics {
694979 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
1691669 nanoseconds spent preparing 7 JDBC statements;
2225822 nanoseconds spent executing 7 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
0 nanoseconds spent executing 0 flushes (flushing a total of 0 entities and 0 collections);
14179 nanoseconds spent executing 1 partial-flushes (flushing a total of 0 entities and 0 collections)
}
2020-09-17 16:51:34.082 INFO 2828 --- [nio-8080-exec-4] i.StatisticalLoggingSessionEventListener : Session Metrics {
596899 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
2083482 nanoseconds spent preparing 4 JDBC statements;
1680342 nanoseconds spent executing 4 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
0 nanoseconds spent executing 0 flushes (flushing a total of 0 entities and 0 collections);
2520 nanoseconds spent executing 1 partial-flushes (flushing a total of 0 entities and 0 collections)
}
0
스프링에서 지원해주는것은 발견했었는데 혹시 하이버네이트나 JPA에서 지원하는 것은 있을지 궁금했습니다!
https://www.logicbig.com/tutorials/spring-framework/spring-data/derived-count-query.html
강의 너무나 감사드립니다, 짧은 시간동안 집중해서 듣고 있는데 폭풍성장하는 것을 느끼고 있습니다