I just received an instruction for the application, the purpose of which is to extract a large amount of data (up to 100,000 rows from a table containing 10,000,000 rows). Unfortunately, the extraction is written in Java + Hibernate, and the performance is relatively small. Retrieving 100,000 rows using Java + Hibernate takes approximately 1 minute and 30 seconds. The same extraction using Talend takes about 30 seconds (3 times less).
Here is an example of what the code looks like:
Launcher.initStatelessSession();
Launcher.beginStatelessTransaction();
int fetchSize = 1000;
crit.setFetchSize(fetchSize);
crit.setCacheable(false);
crit.setReadOnly(true);
ScrollableResults result = crit.scroll(ScrollMode.FORWARD_ONLY);
while (result.next()) {
}
Any optimization idea that could speed up this query? There is currently no plan to abandon Hibernate for anything else.
source
share