You are here: Tuning > Runtime Statistics > Monitoring Queries

Monitoring Queries

You can monitor queries to find out more about the runtime behavior of your application.

Configure the Query Monitoring Support

First you need to add the monitoring support to the db4o configuration. There are two separate items. The QueryMonitoringSupport will monitor the very basic query operations. The NativeQueryMonitoringSupport adds additional statistics about LINQ and native queries.

configuration.Common.Add(new QueryMonitoringSupport());
configuration.Common.Add(new NativeQueryMonitoringSupport());
QueryMonitoring.cs: Add query monitoring
configuration.Common.Add(New QueryMonitoringSupport())
configuration.Common.Add(New NativeQueryMonitoringSupport())
QueryMonitoring.vb: Add query monitoring

The Query Statistics

class index scans/sec: Tells you the number of queries which required to scan through all objects. This means that a query couldn't use a field index and therefore required to go through all objects. This is of course slow. You should try to keep this number low by adding the right indexes on fields. See "Indexing"

queries/sec: Tells you how many queries run per second.

The Native Query Statistics

native queries/sec: Tells you how many native queries per second run.

unoptimized native queries/sec: Tells you how many unoptimized native queries run per second. Such queries need to instantiate all objects which is a slow operation. If this number is high, you should try to simplify your queries.

linq queries/sec: Tells you how many db4o-LINQ queries run per second.

unoptimized linq queries/sec: Tells you how many unoptimized LINQ run per second . You should avoid unoptimized LINQ-queries, because these queries instantiate allobjects to perform the query and therefore are slow. Try to write a more simple LINQ-query. See "LINQ"