Hi everyone, I need some assistance regarding the performance of update queries when executed through Hibernate. The problem scenario has been explained below.
Problem Scenario :- My Java application uses Hibernate to connect to Postgres 9.1 database and perform necessary operations. Since I am dealing with tables that are created dynamically, therefore, I create dynamic update statements in the native Sql within the application, and execute them using the executeUpdate() method of the SQLQuery class. The amount of data on which these updates may happen can range from a few thousand records to millions.
Issue :- The problem is the performance of the query. When executing the dynamically formed update query directly on the DB, it takes a few seconds ( Initially tested for 60000 records ) whereas, the same query when executed through application took around 18 minutes to execute for the same set of records. The execution times grow out of proportion as the number of records on which the update operation is happening increases.
What can be the possible cause of this difference in the execution time? Is there some Hibernate setting that I need to check or configure before execution?
Any pointers or suggestions will be greatly helpful.
Thanks in Advance, Amal
|