Search code examples
oracle-databasejpasequencebulkinsertopenjpa

OpenJPA: Bottleneck Sequence in Bulk Insert


I use OpenJpa on a WAS 8.0 and a Oracle 11 DB ... (afaik OpenJPA 2.1) I have a bulk insert with a entity. (300.000)

Tests: I save the entitys with id generation from sequence and with a own generated id.

Result:

Insert 200.000 Entitys with persist:
With Sequence 2 Minutes and 30 seconds.
With own id 35 seconds.

Insert 500.000 Entitys with persist:
With Sequence 5 Minutes
With own id 100 seconds.

The problem is that the sequence trigger every insert. But i should use the sequence.

I read something about allowcationsize caches the values in jvm, i think, that is the right way but it is OpenJPA 2.2 (http://openjpa.apache.org/builds/2.3.0/apache-openjpa/docs/jpa_2.2.html)

Is there another good way to do this?

Thank you for your time.


Solution

  • Try to up the size of the sequence generator allocation size.