db4o Performance Pitfalls

by Christoph Menge in db4o, Software

This is just a quick note, but I just gotta share this right now.

It’s actually in the manual so this is not exactly a secret, but I managed to overlook it so perhaps I’m not the only one…

In our specific scenario, db4o was about 3 times slower than MSSQL via Linq to SQL in the past days.

Just a few minutes ago, I finally read this:

Native Query optimizer for .NET requires the following libraries to work:
Db4obects.Db4o.Instrumentation.dll
Db4objects.Db4o.NativeQueries.dll
Mono.Cecil.dll
Cecil.FlowAnalysis.dll

(see http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html)

I added these dll’s to my solution and wooosh! Now it’s up to 50 times faster than before! That’s what I needed… Will see how this works with larger data sets…

Update: There have been some important changes in builds past 14021, see my more recent post on that topic. In short, the new kid in town is Mono.Reflection.dll, which took Cecil’s place.

Post to Twitter Post to Delicious Post to Digg Post to Facebook

Related posts:

  1. db4o Queries on Large Datasets and a bit of Linq

Tags: , , ,

← Previous

Next →

5 Comments

  1. siaqodb_user says:

    You can also try siaqodb ( http://siaqodb.com ). Has also very fast LINQ queries and in plus support LINQ on Silverlight

  2. Thanks for the comment. I think it’s good to see more innovative solutions approaching data storage come up.

    What I posted is not entirely specific to db4o: calling a lambda expression will require object instantiation, while parsing the expression tree does not. The latter is obviously much faster, but also more complicated. db4o’s support for it is quite good, however – as long as you don’t leave out the required libraries.

    siaqodb sure looks interesting because it has a very small footprint. On the other hand, for a commercial project I’d stick to a solution that has some history and a strong community.

    Also, siaqodb is not open source which would help to build the required amount of trust, especially in the beginning where community support will not be strong.

  3. siaqodb_user says:

    Christoph,
    Indeed siaqodb is commercial, but as you said: “On the other hand, for a commercial project I’d stick to a solution that has some history and a strong community.” this means you need also to buy license for db4o because for commercial projects db4o is not free.
    Is also true that siaqodb is not lauched too long time ago, but already has a lot of interests from developers and speacially from Silverlight developers because LINQ is supported by siaqodb on Silverlight and has small footprint which is very important because user need to download small .XAP file.

  4. Benny says:

    For this optimizer to work, just put those dll? no code change required?

  5. In my case, yes. Native query optimization in db4o depends on those dlls – if the .dlls are missing, optimization won’t work.

    However, there are many reasons why the optimization could still fail. Mostly this happens because people call methods that can’t be optimized.

    The current optimizer supports only a small subset of what LINQ to objects supports. Complicated string operations won’t be optimized either. See http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html for details and a list of supported operations.

Leave a Comment