0

Using springboot native query is making the api slower in 2million records.Normal sql executes in 1.2s while the query in spring boot is taking 7s why?.What is the possible alternative.Is it due to number of filter parameters i am passing.Want to know the complete analysis instead os short answer like below. Not a dublicate of below one.

Hibernate is 1000 times slower than sql query

@Query(value = "xyz full query");
List<SpDetail> findBySpIdIn(
    @Param("status") String status,
    @Param("date") String date,
    @Param("isWhitelisted") Boolean isWhitelisted,
    @Param("clusterName") String clusterName,
    @Param("firstBooking") Integer firstBooking,
    @Param("reachedOutStatusList") List<String> reachedOutStatusList,
    @Param("spMobile") String spMobile,
    @Param("limit") Integer limit,
    @Param("offset") Integer offset,
    @Param("total_orders") Integer totalOrders,
    @Param("explicitLoad") Integer explicitLoad,
    @Param("reachoutCompletedCount") Long reachoutCompletedCount
);
  • Can you add to the question the query (or queries) that is executed? – A. Wolf Jan 26 '20 at 22:44
  • it does not has anyhting to do query as it executes faster in sql in 1.2 sec – deadly beast Jan 27 '20 at 05:10
  • I'm sorry, I don't understand what you mean. I ask this because Hibernate sometimes creates extra queries that you won't imagine are executed. Have you add to your log file the executed query making the log level of hibernate to ```TRACE```? – A. Wolf Jan 27 '20 at 07:42

0 Answers0