You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Oleg Nitz <on...@ukr.net> on 2003/08/26 01:36:33 UTC

Batch retrieval

Hi!

I have commited some changes to the OJB core, but if they are not in time, 
they can be easily turned off via the 'autoPrefetch' field in 
PersistenceBrokerImpl.java
The idea is to make retrieval more efficient via gathering them into batches 
(less queries => less network and database hits).
For the "broker" junit tests the number of SELECT queries is reduces by 9%, 
for "odmg" junit tests - by 18%, but I expect much more gain in the real life 
complicated object structures.
How does it works? During every getCollectionByQuery() call of 
PersistenceBroker all objects that should be retrieved via relations with 
auto-retrieve="true" (without proxies and without QueryCustomizer),
are not retrieved immediately, but the tasks for their retrieval are 
collected. They are gathered into groups of similar tasks and executed at the 
end of getCollectionByQuery(). 
Also this means that during retrieval of one object of class A which has 1:N 
relation to class B which has 1:N relation to class C and N:1 relation to 
class D, all C's and and D's will be loaded by one query for each relation.
This algoritm uses Jackob's prefetching classes, but methods that modify 
metadata are not used. 

Regards,
 Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org