Issue
I'm experiencing a strange slowness in my new spring boot application, when I fetch a table for reporting purposes.
This is a simple table, no reference to other tables, and it has 5 columns. Rows are 50k. So, I use the simple findAll() method, which is available in JpaRepository.
When the "destination" result is the entity, the findAll() execution takes 5 minutes. When I setup DTO class projection, or interface projection, the execution takes 1-2 minutes.
I believe this is still too much for that amount of data.
Moreover hibernate statistics provides execution time like 0.5 seconds. What takes the remaining 1-2 minutes to get the data in DTO type?
Solution
Finally the solution for this issue was to change from JPA repository to JdbcTemplate.
I constructed a query, and with a data mapper parameter I could get my list into a DTO type in Java. The speed is unbelievable after those many trials with JPA query. which was 5 mins with JPA, it became 2 seconds with JdbcTemplate.query().
after all i would like to know what is changed from Spring 4.3 to Spring Boot 2.5.5
Answered By - pillesoft