I am learning db4o and like it a lot.
Obviously I testing performance. And I do have a problem with the following.
I am using SODA.
My database contains 2 000 Products, 30 100 Customers and 300 100 Orders.
An Order contains a reference to a Product instance and a Customer Instance.
I have one index on Customer.LastName, Order.Amount and Product.Name.
To make myself clear I will use the SQL metaphore.
The following query run in 0.15s
SELECT * FROM 'Order'
WHERE
Amount = '9560.333333333333333333333333'
Bit the following query run in 5s
SELECT * FROM 'Order'
WHERE
Amount = '9560.333333333333333333333333' and
Customer.LastName = 'Colette U.1'
Here I am referencing the property LastName from the Customer instance referenced by the Order instance.
Here is my C# code
IQuery query = cm._db.Query();
query.Constrain(typeof(db4oMSE.TestClasses.Order));
IConstraint C1 = query.Descend("Amount").Constrain(9560.333333333333333333333333M);
IConstraint C2 = query.Descend("Customer").Descend("LastName").Constrain("Colette U.1");
C2.And(C1);
Db4objects.Db4o.IObjectSet ResultSet = query.Execute();
What is the right way to write this kind of query ?
How do we make it faster ?
With a relational database this kind of query with a inner join with the right indexes would not take 5 seconds.
Thanks.