[odb-users] slow persist for bulk insert

Boris Kolpackov boris at codesynthesis.com
Tue Oct 28 06:31:59 EDT 2014


Hi Erez,

Erez GB <erezgb at walla.com> writes:

> Following what you suggested, we might need to consider SQLite Prepared
> Statement as a mean for bulk insert

ODB already uses prepared statements. It also caches/reuses prepared
statements and even memory buffers. I think you will be hard-pressed
to achieve better performance with hand-coded INSERTs unless you
exploit some application-specific knowledge (which is, generally,
quite hard to do in the case of INSERT).


>   * Assuming I will use SQLite functions to perform them, can ODB database
>     expose it's internal SQLite Database Connection Handle so I can use the
>     same connection with SQLite functions ?

Yes, see Section 18.3, "SQLite Connection and Connection Factory".


>   * Can ODB objects expose the Insert statment for external use?

You can use them (see libodb-sqlite/odb/sqlite/statement.hxx) though
they are quite low level and optimized for the way ODB does things
(e.g., caching/reusing as much as possible).


>   * Anything else that might help me use ODB with SQLite Prepared 
>     Statement ?

As I said, you are already using prepared statements. What you can
do is show us the class you are trying to persist, your transaction,
the numbers that you get, and the numbers that you would like to get.
Even better way would be to create a test program that mimics your
application scenario that we can try.

Boris



More information about the odb-users mailing list