[odb-users] Options to speed up object persist to sqlite3 DB?

Boris Kolpackov boris at codesynthesis.com
Mon Dec 16 06:49:13 EST 2019


Justin Huang <yohuang at nvidia.com> writes:

> I used VTune to profile my program and it showed odb::database::persist
> (more specifically odb::sqlite::insert_statement::execute) is the bottle
> neck. It takes around 3 seconds to persist 7k simple object (I am not
> quite sure if this is normal or not).
> 
> In my program, I iterate all objects and call db->persist(object) one
> by one. Are there faster ways to persist objects?

Normally, for best performance, you would want to batch perists into
several transactions. That is, persist N objects per transaction,
commit it, start the next transaction, persist the next N objects,
and so on. You will need to experiment to find the best N (it would
depend on the size/shape of your objects, etc).

Beyond that, SQLite includes a lot of tunable options that allow you
to speed things up, usually at the expense for consistency and/or
reliability. I suggest that you google for these since they are
not ODB-specific.



More information about the odb-users mailing list