thanks for your remarks indikak, but i dont use a jboss here. i think its about this cursor thing.
i finally managed to keep the memory (on the indexing machine) at round about 200mb for the java process, doing it like this:
Code:
int PAGESIZE = 100;
int currentElement = 0;
Criteria crit = dbSession.createCriteria(Attribute.class);
crit.setFirstResult(currentElement);
crit.setMaxResults(PAGESIZE);
List<Attribute> results = crit.list();
while (results.size() > 0) {
fSession.beginTransaction();
for (Attribute r : results) {
fSession.index(r);
}
fSession.getTransaction().commit();
fSession.clear();
results.clear();
crit = dbSession.createCriteria(Attribute.class);
crit.setFirstResult(currentElement + PAGESIZE);
currentElement += PAGESIZE;
crit.setMaxResults(PAGESIZE);
results = crit.list();
}
I tried to index my test db with round about 700k entries last night with this code, but as i just returned to the machine, it has indexed just 380k entries in 13h, thats totally not acceptable, or is it?
the processor load of the db host was at 100%, which isnt acceptable either, since there are other project, using this host.
Is it a possibilty to create a new fulltextsession every iteration?