What's New
Lazy Queries
The old db4o query processor uses a strategy of full query evaluation upon execution. It results in delivering the complete ObjectSet of all matching IDs. In cases of big result sets this can become considerably time and memory consuming.
Db4o 6.0 gives you a better choice:
- Lazy queries
- Snapshot queries
The basic idea is: instead of full query processing upon query execution, we only choose the best index, creating an iterator against it, or select best indexes, creating their snapshot at the point in time. All the rest of the query processing is done object-per-object while your application iterates through the ObjectSet and calls #next()/#MoveNext().
The functionality of Lazy and Snapshot queries is similar and the difference is in the level of "lazyness":
Obvious advantages of the new query types are:
- considerably reduced execution time
- parallel query execution and query result processing for lazy queries
- reduced memory consumption (next to nothing for lazy queries)
However there are some hidden drawbacks:
- For Snapshot queries it would be memory, occupied by entire candidate index, until clean up by GC.
- For lazy queries it is an undeterministic behavior in cases with concurrent modifications.
The old query evaluation mode is called Immediate mode and is a default setting.
The recommendations are:
- use Lazy mode for a single transaction read use, to keep memory consumption as low as possible.
- for Client/Server applications with the risk of concurrent modifications prefer Snapshot mode to avoid side effects from other transactions.
For more detailed information see QueryConfiguration interface in the API reference.
.NET Conventions
The 6.0 version introduces full support for .NET conventions resulting in more than ever native db4o for .NET and Mono.
- The more obvious changes are in the namespaces naming. Instead of having a Javaish com.db4o, we now have a nice
Db4objects.Db4o namespace.
- Another big change is that according to the framework conventions, all our interfaces's names start with an
I (like IObjectContainer,IObjectSet etc).
- For all of you who use a case-insensitive language, like VB.NET, we renamed the Db4o class that used to clash with the namespace, to
Db4oFactory.
- Every possible class was converted to its .NET equivalent. (For example collection types now implement System.Collections.IEnumerator or System.Collections.IEnumerable instead of db4o own types).
- Some less noticeable (but not less valuable) changes occurred under the hood, like using the native .NET type system directly, instead of using our old j4o layer on top of it
Of course, we still ship a legacy version of db4o 6.0, which uses the old conventions for our existing users. This legacy assembly keeps its old name: db4o.dll, while the new one is named Db4objects.Db4o.dll. Hence, no confusion is possible.
Fast Defragment
As of version 6.0 db4o provides a new defragment mechanism. While the old mechanism would instantiate live objects to transfer them to the defragmented database file, the new version operates directly at the slot/file level, avoiding any reflection or object instantiation calls.
The new defragment mechanism is deeply integrated with the core classes and therefore has been moved from db4o tools directly into the core.
Please check defragment package/Defragment namespace in the API documentation for more information.
Db4o Replication System (dRS)
Together with the new 6.0 version of db4o we release a new version of our synchronization engine - dRS 6.0.
- On the java side dRS 6.0 introduces support for the latest version of Hibernate - 3.2.
- On the .NET side, dRS 6.0 follows the core with the .NET conventions implementation.
Object Manager
New ObjectManager 6.0 version released for full compatibility with db4o-6.0. The changes include:
- bug fixes (including querying primitives)
- improved support for .NET databases
Upgrading To Version 6.0
In general upgrading your existing application to db4o-6.0 should be easy and straightforward. However here are some recommendations on the topics that will need your attention:
.NET Conventions Notes
- Change imported namespace names to
Db4objects.Db4o[.Xxx] template
- Add
I prefix to the interface names (like IObjectContainer, IQuery etc)
- Change static
Db4o class to Db4oFactory.