Database Reference
In-Depth Information
As previously mentioned, we need to run that type of query for every level of
our hierarchy:
Adding intermediate pricing information
About 35 seconds later, this is all done, which is quite impressive.
Now that we have the intermediate pricing information, calculating the price of
the product only needs to traverse one level deep. We use a query similar to the
following one:
match (n1:PRODUCT {id:1})<-[r1]-(n2:COST_GROUP)
return sum(r1.quantity*n2.price);
Ofcourse,thisqueryissigniicantlyfaster,asitonlytouchesahundredorsonodes
and relationships—instead of 2.1 million of each. So, note the super-fast query that
yields an identical result to the full sweep of the tree mentioned previously:
Calculating price based on intermediate pricing
Now that we have done this optimization once, we can use this mechanism for our
impact simulation queries.
 
Search WWH ::




Custom Search