[odb-users] Erase/Remove Performance comparison to native SQL

Boris Kolpackov boris at codesynthesis.com
Thu Apr 17 09:49:02 EDT 2014


Hi Christian,

Lichtenberger, Christian <christian.lichtenberger at etm.at> writes:

> Is a session required to enable caching? Or why the number of statements
> got reduced? I thought a cache exists per connection! But now I read in
> the manual that a session is primary a cache.

There are different kind of caches in ODB. There is a statement cache
per connection, but that you don't see. Session is an object cache.
That is, if a session instance is created, then every object loaded
is added to the session. And, if an object already exists in the
cache, then it is returned directly, instead of loading it from the
database. The manual explains all this in detail.


> If a attribute is inverse and defined as QLazySharedPointer also a
> SELECT statement is performed?

Yes, that's correct.


> I thought that the lazy means that it is loaded later.

The objects are loaded later, not the list of objects. However, you
can get this bahavior (lazy list of lazy pointers) using a lazy-loaded
section (Chapter 9, "Sections" in the ODB manual).


> Or means lazy that a SELECT for the ids is performed and the objects
> behind are loaded later!?

Exactly.


> The foreign key problem I must figure out later.

There is not much to figure, really. If you enable foreign key
checking, SQLite runs slower since it now has to check them. So,
this boils down to whether you are willing to sacrifice some
performance for extra checks or not.

Boris



More information about the odb-users mailing list