Home » Support » Forum » Performance in SELECT statement

Performance in SELECT statement



I have the following 2 entities :

public class TestEntity implements LocalEntity
    private Long key;
    private Long clientKey;
    private String text1;
    private String text2;
    private String text3;
    private String text4;
    private String text5;
    private Object value; // for now just Double values

    private long timestamp;

    private State state;

    ... getter/setters ...

public class State
    private Long lastProcessingDate;
    private int processingCount;

    private EntityState entityState;

    ... getters / setters ...

when I query by the "state" field in TestEntity it tooks several seconds to retrieve the objects (around 5s) and I
think I do something wrong because it's so slow. (DB has around 30.000 rows)

Example query looks like :

String strSelect = "SELECT e FROM TestEntity WHERE e.state.entityState IN :state";

TypedQuery<TestEntity> query = em.createQuery(strSelect, TestEntity.class);   
query.setParameter("state", EnumSet.of(State.NEW, State.ACKNOWLEDGED));

List<TestEntity> results = query.getResultList();

I would be very happy if someone could give me a hint why this query tooks so long.

edit: I just tried to remove the second entity completely and integrate its 3 variables directly in the TestEntity...
but it makes no difference.

edit2: persisting values is also very slow (5-6s for 30.000 inserts). Environment is JBoss Wildfly 9.0.2. Classes are enhanced...




The index definition is invalid. You cannot define an index directly on a field of embeddable class. Define a path index on TestEntity instead:

public class TestEntity implements LocalEntity

Please create a separate thread regarding the persisting performance and provide more details and sample code.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

The index thing did the trick! Thank you... I will post another thread for the performance issue


Post Reply

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