[odb-users] Performance issues for large sets

Boris Kolpackov boris at codesynthesis.com
Thu Sep 18 03:31:43 EDT 2014


Hi Quentin,

Quentin Deldycke <quentindeldycke at gmail.com> writes:

> I have a class, itself linked to multiple sub-classes, when i iterate over
> them, i only acces fields from the 'root' table.
> 
> I don't understand how odb works at this moment. At the global scope,
> ODB queries the 'root' object, then at each iterator, ODB select the
> different sub-objects.

Ok, I assume you are using polymorphic inheritance in which case, for
derived classes, their data members are stored in multiple tables. So
when you query for a base class, ODB loads you actual, dynamic instances
of the objects. To put it another way, when you query for the base, the
result of the query is a mixture of various derived objects (returned as
their base interface).


> Is there any way to:
> 
>    - disable select for sub objects when they are not directly accessed?
>    - force select for sub objects at global scope?

I am not sure what you mean by the last item, but the best way to
achieve what you want is with ODB views. Not only can you select
just the data members from the base class only, you can go a step
further and only select a subset of data members that you actually
need. See Chapter 10, "Views" in the ODB manual.

Also, generally, when you have a performance/database load issue
with a query, ODB views are the answer.

Boris



More information about the odb-users mailing list