Recently I have been given the task to research and deliver a proof of concept of the effects of a NoSQL database. I have chosen Neo4j as the NoSQL database for this .NET application.
The thing is... When I execute a query using the Neo4j Client, it runs in 10-20 ms which is fantastic. Whenever I execute that query through code it takes 150-200 ms, which is huge difference.
The query is the following (a Bank is the dutch equivalent of a database)
The goal I want to achieve is get every Bank with their Children (To get the whole hierarchy):
MATCH (bank:Bank)-[:PARENT_OF]->(bank2:Bank)
Return (bank.id),collect(bank2.id)
This is the code I have used to execute the query.
var query = client.Cypher.Match("(bank:Bank)-[:PARENT_OF]->(child:Bank)")
.Return((bank, child) => new
{
Bank = bank.As<Bank>(),
Children = child.CollectAs<Bank>()
});
var list = query.Results
My question is: Why is the query 10 times slower through code as opposed to the Neo4j Client?