[odb-users] lazy pointers not working and update performance issue

Luisa Giacomini luisagiacomini.eu at gmail.com
Thu Feb 25 11:37:35 EST 2016


Hi Boris, I am quite new to odb and I have some performance issues.
I am using sqlite with odb 2.3.0 (sqlite is mandatory, the odb version
is due to a platform issue and I can eventually upgrade to 2.4.0 if
really necessary)

1. The first problem is how to load the shared_ptr of an object, to be used
as a foreign key into another object, without actually loading the object.
I found on the manual the topic "lazy pointers" and it looks as if it
exactly what I
am looking for but it does not work.

I tried this
std::string str = "TERMINAL1";
lazy_shared_ptr<Terminal> er (db,str);  //TERMINAL1 exists always
SvTerminal svt; //SvTerminal has a field named mrid that is a
shared_ptr vs Terminal
svt.mrid(er.get_eager());
persist(svt);
and yes, the shared_prt is null. What I am doing wrong?

2. I have found that the update instruction is quite slow; actually I
have a table of 7000 elements, I load them, I modify a few fields and
then call update one by one.
The overall execution time is about 3sec, 1sec just for the updates.
Is it possible to speed up the process, at least the update one with
some kind of batch operation?

Thanks in advance, Luisa.



More information about the odb-users mailing list