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

#1

Hello,

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.

SELECT v.sheetUID FROM TCVector

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?

@Entity
@Access (AccessType.FIELD)
public class TCVector {

    @Basic
    private String architecture;

    @Basic
    private String scopeID;

    @Basic
    private String name;

    @Basic
    private String description;

    @Basic
    private int signalIndex = 0;

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

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

    @Basic
    private String sheetUID;

    @Transient
    private StepNumberCache stepNumberCache;

 

#2

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

thank you very much for the hint


Post Reply

To post a reply and/or subscribe to update notifications - please login