Monitoring Optimization

This feature still is quite basic but it will soon be improved.

Monitoring Optimization On Java

Currently you can only attach a listener to the ObjectContainer:

NQExample.java: nqListener
1public static void nqListener() { 2 ObjectContainer db = Db4o.openFile(DBFILENAME); 3 ((YapStream) db).getNativeQueryHandler().addListener( 4 new Db4oQueryExecutionListener() { 5 public void notifyQueryExecuted(NQOptimizationInfo info) { 6 System.err.println(info); 7 } 8 }); 9 }

The listener will be notified on each native query call and will be passed the Predicate object processed, the optimized expression tree (if successful) and the success status of the optimization run:

YapStream.UNOPTIMIZED ("UNOPTIMIZED")

if the predicate could not be optimized and is run in unoptimized mode

YapStream.PREOPTIMIZED ("PREOPTIMIZED")

if the predicate already was optimized (due to class file or load time instrumentation)

YapStream.DYNOPTIMIZED ("DYNOPTIMIZED")

if the predicate was optimized at query execution time