ObjectDB ObjectDB

Performance issue in a query due to internal calls visitRefs and visitKeyRefs



we have a question about a performance issue in a query.

We executed a query on the following entity and there is only one entity in the database and we expects that the query is executed within 1 ms.


But how you can see in the attached snapshot 'stacktrace.png' the execution needs several seconds and we are wondered about the visitRefs and visitKeyRefs calls in the snapshot.

Can you explain why the database spends so much time in the visitRefs and visitKeyRefs?


@Access (AccessType.FIELD)
public class TCVector {

    private String architecture;

    private String scopeID;

    private String name;

    private String description;

    private int signalIndex = 0;

    @OneToMany (cascade = CascadeType.ALL, targetEntity = TCSignal.class, fetch = FetchType.LAZY)
    private List<TCSignal> signals = new ArrayList<>();

    private TreeSet<Long> stepNumbers = new TreeSet<>();

    private String sheetUID;

    private StepNumberCache stepNumberCache;



It seems that the time is spent on a flush operation before the query is executed.

Apparently you have pending changes to the database in the memory. If you can run the query on the database ignoring the pending changes in memory then the query will probably be very fast. If you need to query the data in the database with the pending changes in memory (before commit) then a flush operation is required before the query can be executed.

ObjectDB Support

thank you very much for the hint



To post on this website please sign in.