Again, I'm creating this thread to see if someone has the same issues or if someone knows how to improve performance. Let me explain first the scenario: I have a JDO entity named for example Product. In that product I have a field of another entity, a simple one (Example Type: long id, String name, String value) and 1 date. I created 10000 objects of the product but when i try to query the Product with the dates the performance is good but if I add the type.id == 12 then the performance drops from 100ms to 30 secs... if I instead of having a Type object put a long typeId on the Product, then the same query is also fast... What I'm worried is with scalability, should I flatten the structures and work with ids that are not really connected but needs additional application retrieval or is there a way to improve performance on the query on a Product.Type? Thank you very much in advance.
I've already tried to define fetchGroups, but they don't really work...
What I wanted to do actually is doing a sort of mapping via an ID on the Product, but I couldn't do it with the embedded annotation...
so, let me explain a little better: I have a class named Reading with (one Date timeStamp and a Product p). this is doing a query. If the filter is something like this:
String filter = "timeStamp > fromDate && timeStamp < toDate";
the query executes in 100ms if I do this
String filter = "timeStamp > fromDate && timeStamp < toDate && prod.id == '941'"
for example, it takes 30secs... I've seen the logs, and without the query for the product he only reads from cache, if I add the clause of the Product he seems to fetch all the objects and starts comparing values I imagine...I don't really know what to do, maybe I should disconnect all these classes and start using like a String productID on the Reading class and then everything starts to be fast again... but in reality, the connection is not there, it would be implemented in an application layer... Thanks again... Any advise?
The query generated is something like this: SELECT FROM core.jdo.model.Readings WHERE timeStamp > fromDate && timeStamp < toDate && EAN.EAN == '002' PARAMETERS java.util.Date fromDate, java.util.Date toDate import java.util.Date