ObjectDB ObjectDB

Caching/Paging Questions...

#1

Greetings ObjectDB team,

All below questions assume a very large database (~1,000,000,000 objects):

Q1: Two queries with a big overlap between their result sets. If I query the first set and hold the results in memory somehow, would that speed up the execution of the second query since many of its result objects already created and reside in memory ?

Q2: Do I need to manually use strong references to such cached result objects ? or do ObjectDB exploits frequency of querying such objects and keep them in memory longer automatically somehow before GC takes place ?

Q3: What is the maximum memory size of ObjectDB L2 cache or EntityManager context ?

Q4: Would paging result sets via setFirstResult and setMaxResult speed up the query execution since there are fewer result objects to bring into memory ?

Regards

edit
delete
#2

Query execution is not affected directly by the content of the persistence context (the EntityManager L1 cache) but instantiation of the results (if they contain entity objects) are slightly faster if relevant objects are in the cache (but the difference is not huge).

You can either use application managed strong references or you can set the configuration, so strong references will be used automatically until the persistence context is cleared. For cache purpose - consider soft references, which are something in the middle between weak and strong references.

The size of the L1 cache is automatic. There is no limit on the maximum size of the L2 cache.

Using setFirstResult and setMaxResults could improve performance, but the effect is highly dependent on the specific query.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.