Search code examples
linqperformancedb4o

Improve db4o linq query


I got a problem with this linq query:

from PersistedFileInfo fi in m_Database
from PersistedCommit commit in m_Database
where commit.FileIDs.Contains( fi.ID )
where fi.Path == <given path>
select new Commit( m_Storage, commit );

As you can see, every PersistedCommit contains a Collection<int> called FileIDs which connects it to its PersistedFileInfos. I want to select all previous commits of a specific fileInfo (which is identified by its path).

I have about 800 PersistedFileInfos and 10 PersistedCommits. The query takes about 1.5 seconds - which is in my opition far too long. The contructor of the Commit-object saves only the two given arguments - so there is no timeloss, here.

My question:
Can this query be rewritten to perform better - or is it a db4o problem (use a SODA query instead)?


Solution

  • Please check if your NQ is indeed optimized (see here). If not then your best bet is to translate this into SODA query yourself.

    Goran