javahibernatejdbc

Drawbacks of a high hibernate.jdbc.batch_size setting


I increased the hibernate.jdbc.batch_size parameter to 50. This makes batch processings in our application a lot faster, which is great. Do I need to expect any drawbacks for the "regular" tasks of the application? The application responds to web requests and uses a single database connection per request. Most of the requests read only from the database, some requests save a few objects (but not hundreds).

Thank you very much for sharing your experiences.


Solution

  • The hibernate.jdbc.batch_size parameter determines how many statements are sent to the database in one call. Having too many statements (a higher number) could result in either an OutOfMemoryException or a timeout on the transaction, when doing multiple statements in a transaction.

    With webrequests, you usually have less statements in a transaction. This setting shouldn't influence these transactions.

    Depending on which part of the documentation you read, anywhere between 10 and 50 Hibernate 3.3 chapter 13 or 5 and 30 Hibernate 3.3 chapter 3 is reasonable / recommended.