ObjectDB ObjectDB

Querys slower when execute a query after every persist


The test case of the java file attachment persists many entities and executes a query after every persist.

The execution time amounts 2 sec when the test persists 1000 entities.

The execution time amounts 100 sec when the test persists 10000 entities.

We have been expected that the second case requires only 20 sec, but the test requires 100 sec.

Why the querys will be more and more slower?

In addition there are a cpu snapshot for visual vm and an image of cpu snapshot as attachment.


When entity classes are not enhanced every flush or commit requires comparison of object states in order to find which objects in the persistence context have been modified and should be flushed to the database. If you have more objects in the current transaction it takes more time (i.e. every query execution requires a more expensive flush).

Results of your test with enhanced classes are much better and proportional:

ObjectDB Support


To post on this website please sign in.